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

Re: Run script as often as possible



On Tue, Sep 28, 2004 at 11:23:15AM +0200, Jacob Larsen wrote:
> I have a script that I'd like to run as often as possible.
> The script may only run in 1 instance.
> My idea is to have a cron script to start it once every hour. The script 
> should write a run file, and if the run file exists, exit.
> Is this the best way?

Run it from init by putting an entry into your inittab. As soon as it
exits, init will respawn it. The upside is that there is no need to do
locking or process synchronization. The following inittab entry would
work.

mysc:2345:respawn:/path/to/myscript

-- 
Dave Carrigan
Seattle, WA, USA
dave@rudedog.org | http://www.rudedog.org/ | ICQ:161669680
UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-C++-DNS-PalmOS-PostgreSQL-MySQL

Dave is currently listening to Creedence Clearwater Revival - Travellin' Band (Chronicle)

Attachment: signature.asc
Description: Digital signature


Reply to: