-   Linux - General (
-   -   cron jobs for less than a minute (

golden_boy615 05-08-2010 03:16 PM

cron jobs for less than a minute
how can I cron jobs for less than a minute for example configuring cron job to do something for each 15 seconds.

frostschutz 05-08-2010 04:22 PM

cron jobs is meant for stuff that runs every couple of hours, or even days, weeks, months, so doing something every minute is the best it can do

if you want to do something every 15 seconds, you could make a shell script and sleep instead


while [ 1 ]
    sleep 15

golden_boy615 05-09-2010 02:42 AM

Is any way except that? it makes busy waiting for that.

druuna 05-09-2010 04:18 AM


The shortest time interval you can use with cron is 1 minute.

frostschutz's solution works, although you will introduce a sliding window (the next run will be 15 seconds + runtime of "something").

Hope this helps.

MTK358 05-09-2010 06:55 AM

The sleep command does NOT busy wait, at least my version doesn't. I just tried it.

All times are GMT -5. The time now is 08:52 PM.