[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Sleep v Cron



On Sun, Oct 21, 2007 at 05:56:44PM -0600, Telly Williams wrote:
> Hi,
> 
> 	Hopefully this doesn't sound crazy, but what would be the
> 	pros/cons of using a script with a sleeper instead of a script
> 	via cron?  Seems the same to me(?).  Thanks.

it entirely depends on what you are doing. read the man pages. 

sleep will sleep for the specified time. cron will run the script at
the clock time designated. These are very different things. 

so for example if you have a script with sleep 5 in it somewhere and
the rest of the script takes 6 seconds to do its thing and you start
it at 12:00.00 then it will do its thing until 12:00.06, sleep until
12:00.11, execute until 12:00.17, sleep until 12:00.22 etc. 

if you set a cron job to run every 10 seconds then it will run at
12:00.00, 12:00.10, 12:00.20 etc regardless of how long the execution
takes. Of course, if your script takes longer  than 10 seconds,
you'll have multiple instances running. 

A

Attachment: signature.asc
Description: Digital signature


Reply to: