Re: Making sure one and only one copy of a process is always running

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

 



On Sun, 2 Nov 2003, Rodolfo J. Paiz wrote:

> Hello, all:
> 
> I am trying to create a job which will run for a long time, so I need to 
> make sure that it:
> 
>     * starts up automatically
> 
>     * is always running
> 
>     * checks to see if it is running and restarts itself if the previous 
> instance died
> 
>     * never runs two copies of itself
> 
> I have read through the files in /etc/rc.d/init.d for hints, since I know 
> that somehow they put the PID in a file and then check that file to see if 
> it's running or not. Duplicating this functionality is one possibility.
> 
> I am running a shell script that runs an rsync process, so perhaps even 
> something as simple as checking the exit status of rsync with a while loop 
> inside the script would work. However, I don't know how to do that, and my 
> reading of the bash man page has not provided enough enlightenment.
> 
> Anyone care to offer suggestions?
> 
> Thanks!

You might consider running a cron script that checks for the pid of the
running job, kills it, and then restarts the task.  This also has the
benefit of ensuring that you eliminate any possible memory leaks.

-- 
Gerry

"The lyfe so short, the craft so long to learne"  Chaucer


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux