Question about using pid

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

 



The start-stop-daemon program, might help you with this.

Any kind of do while, while, or similar loop, can do this, as the PID
doesn't have to matter.  If you keep the process in the foreground, the
shell's next command can not run until the command exits.  So, if you put
it in a while loop, the shell's next command will be to restart the loop,
thus rerunning the program, and achieving what you want.

If you want to test for fail conditions, put an if test for $? after the
command, with a break command to be executed if the program returns
anything other than zero.

Luke




On Mon, 20 Oct 2003, Janina Sajka wrote:

> I have a command that starts a process. Should that process die whilst
> I'm not at my computer, I want a script to restart it.
>
> How do I do this? What doc might I read that would provide examples?
>
> I presume I should launch the process so that it's pid is written to a
> file, and then I can just test for the running pid?
>
> But, I don't know how to go forward with this, so would appreciate all
> advice and direction.
>
>
>

-- 
Want a free month of internet access on a great ISP?  Go here:
http://www.tacticus.com/net/




[Index of Archives]     [Linux for the Blind]     [Fedora Discussioin]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]
  Powered by Linux