Thursday, April 09, 2009

run cron job in seconds

while scheduling a cronjob i found out that cron wakes up every minute and executes the jobs for that minute. i needed to run a job every 30 seconds. so what to do. i was confused. later i searched for it and found out it is too simply done. just add another entry that will sleep 30 seconds and execute the job. add these lines in the crontab -

00-59 * * * * root sh /home/me/myscript.sh
00-59 * * * * root sleep 30 && sh /home/me/myscript.sh

423 comments:

«Oldest   ‹Older   601 – 423 of 423
«Oldest ‹Older   601 – 423 of 423   Newer› Newest»

About Me

the most common nick i got from my friends is angry-kid or anger management(needed). i normally see the glass half empty. the ideas i believe in are mostly laughed at by people. as much irritated, saddist pessimistic as a human being can be....X-(