Re: centos command to monitor a process for exit

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



Jerry Geis wrote:
Is there a command that will monitor a process for exiting (crash or normal exit) and then execute another command based on the said process no longer being active?

Or is there a "wrapper" command that runs a process and when that process exists
due to crashing or just exiting normally) that another process can be run.


Why not use a shell script as a wrapper? If you don't put something in the background with an & on the line, the next line will execute when/if the program started on the current line exits. There are nearly always other copies of the shell running anyway so you get shared-text efficiency. If you just want to keep restarting the same program, something like this should run forever.

while :
 do
  my_program
 done


--
  Les Mikesell
   lesmikesell@xxxxxxxxx
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux