Jeff Abrahamson on Wed, 18 Jul 2001 06:50:05 -0400 |
FYI, this was Re: [PLUG] Specify seconds in cron ? In-Reply-To: <Pine.GSO.4.33.0107180046010.10801-100000@red.seas.upenn.edu>; from sudas@seas.upenn.edu on Wed, Jul 18, 2001 at 12:46:41AM -0400 On Wed, Jul 18, 2001 at 12:46:41AM -0400, Sandhitsu R Das wrote: > > I want to run something every 45 seconds ? Can I do this with cron or any > variant ? #!/bin/sh do_it & # runs at time 0 sleep 45 do_it & # runs at time :45 sleep 45 do_it & # runs at time 1:30 sleep 45 do_it & # runs at time 2:15 Have cron run this every three minutes. Note, though, that cron does not guarantee fine-grain scheduling, so you might be off a bit. But it's close. Why 45 seconds? Alternatively, have cron check every few minutes that the following shell script is still running, and if not relaunch it: #!/bin/sh while true; do do_it &; sleep 45; done In all of the above you can get rid of the ampersands if the run time for do_it is not a concern. -- Jeff Jeff Abrahamson <http://www.purple.com/jeff/> ______________________________________________________________________ Philadelphia Linux Users Group - http://www.phillylinux.org Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce General Discussion - http://lists.phillylinux.org/mail/listinfo/plug
|
|