LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Running a command after a delay of n secs (https://www.linuxquestions.org/questions/linux-newbie-8/running-a-command-after-a-delay-of-n-secs-449379/)

anjanesh 05-28-2006 02:36 PM

Running a command after a delay of n secs
 
Hi

Is there a command which will run a command I specify (this latter command will be the argument in the former one) after n seconds ?

Something like runlater "ls -l", 10

Thanks

drkstr 05-28-2006 02:40 PM

'sleep n && ls -l' should do the trick. 'man sleep' for a full list of options.

regards,
...drkstr

osor 05-28-2006 02:46 PM

What's wrong with the sleep command?

Example:
Code:

sleep 10 && ls -l

anjanesh 05-28-2006 03:28 PM

Oh...didnt know we could have && in shell - thanks.
So if I wanted a php script to execute after 10 secs,
sleep 10 && php path/scrtip.php will work ?

pixellany 05-28-2006 04:41 PM

Or you can use "at"

drkstr 05-28-2006 05:00 PM

Yup, you are just telling it to run the next command after the first one finishes. You can do as many as you want. I use it when I compile my kernel so I can just type one command and walk away until it finishes.

regards,
...drkstr


All times are GMT -5. The time now is 12:13 AM.