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

Re: Run script as often as possible



On Tuesday 28 September 2004 16:30, Dave Carrigan wrote:

> 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

That runs the script as root, right?  If you wanted to run it with as
another user, would you just stick a bit of sudo in that inittab entry?



Reply to: