everactive
asked on
Running cron job every 10 seconds
Hello,
Is it possible to run a cron job every 10 seconds?
Thanks.
Is it possible to run a cron job every 10 seconds?
Thanks.
*/6 * * * * /path/to/script
That should work
That should work
nice.
wareb73's way is much cleaner.
wareb73's way is much cleaner.
No that should not work, that means every 6 minutes not a minute divided by 6
the only way you can do this is by enabling a time sleep under your script
the only way you can do this is by enabling a time sleep under your script
Yes a far my understanding of cron u cannot run jobs every few secs without using help of sleep command inside the script
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
another way if it isn't a script is doing:
* * * * * /path/to/program
* * * * * /usr/bin/sleep 10 && /path/to/program
* * * * * /usr/bin/sleep 20 && /path/to/program
* * * * * /usr/bin/sleep 30 && /path/to/program
* * * * * /usr/bin/sleep 40 && /path/to/program
* * * * * /usr/bin/sleep 50 && /path/to/program
or if it's a script you do:
* * * * * /path/to/script
then you can have something like the following in the script:
I=0
while [ ${I} -le 50 ]; do
I=`/usr/bin/expr ${I} + 10`
/path/to/program
/usr/bin/sleep 10
done
* * * * * /path/to/program
* * * * * /usr/bin/sleep 10 && /path/to/program
* * * * * /usr/bin/sleep 20 && /path/to/program
* * * * * /usr/bin/sleep 30 && /path/to/program
* * * * * /usr/bin/sleep 40 && /path/to/program
* * * * * /usr/bin/sleep 50 && /path/to/program
or if it's a script you do:
* * * * * /path/to/script
then you can have something like the following in the script:
I=0
while [ ${I} -le 50 ]; do
I=`/usr/bin/expr ${I} + 10`
/path/to/program
/usr/bin/sleep 10
done
* * * * * /home/mylogin/somescript 10
* * * * * /home/mylogin/somescript 20
* * * * * /home/mylogin/somescript 30
sleep $1
.... rest of script follows