Hi all, Can someone pls help me on how to make this bash script? I want to monitor a process, and then when the process (for some reason) dies, the script will start the process again. Thank you, -- Fajar Priyanto | Reg'd Linux User #327841 | Linux tutorial http://linux2.arinet.org 18:39:44 up 10:21, 2.6.16-1.2111_FC5 GNU/Linux Let's use OpenOffice. http://www.openoffice.org
On Fri, Jun 16, 2006 at 06:39:52PM +0700, Fajar Priyanto enlightened us:> Can someone pls help me on how to make this bash script? > I want to monitor a process, and then when the process (for some reason) dies, > the script will start the process again. > Thank you,This is not the appropriate place for that kind of question. You should look for help on a bash mailing-list, website or IRC channel. What you want to do sounds amazingly similar to what the mysqld_safe script does, so you might consider looking at ohter examples like that to do what you want. Matt -- Matt Hyclak Department of Mathematics Department of Social Work Ohio University (740) 593-1263
On 6/16/06, Fajar Priyanto <fajarpri at cbn.net.id> wrote:> Hi all, > Can someone pls help me on how to make this bash script? > I want to monitor a process, and then when the process (for some reason) dies, > the script will start the process again.One possible approach is to look at an offering from qmail's author, D. J. Bernstein <http://cr.yp.to/djb.html>. DBJ publishes a very useful set of tools known as daemontools <http://cr.yp.to/daemontools.html>. Supervise <http://cr.yp.to/daemontools/supervise.html> switches to the directory named s and starts ./run. It restarts ./run if ./run exits. It pauses for a second after starting ./run, so that it does not loop too quickly if ./run exits immediately. Monit <http://www.tildeslash.com/monit/> is a utility for managing and monitoring, processes, files, directories and devices on a UNIX system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations. restartWrapper (comes with Radiator) is something that has never failed our operation in a decade, but I'm not sure what the license looks like. rgds/ldv
On Fri, 2006-06-16 at 06:39, Fajar Priyanto wrote:> Hi all, > Can someone pls help me on how to make this bash script? > I want to monitor a process, and then when the process (for some reason) dies, > the script will start the process again.If you want it to happen at the system level, look at a 'respawn' entry in /etc/inittab. In a shell script, you can use ':' to mean forever in a while target: while : do yourprogram done -- Les Mikesell lesmikesell at gmail.com
You don't need create a script for this. Use one that already exists. Monit can solve your problems. http://www.tildeslash.com/monit/ There is also a rpm package for rhel4/centos4 into Dag's repository at http://dag.wieers.com/packages/monit/ On 6/16/06, Fajar Priyanto <fajarpri at cbn.net.id> wrote:> Hi all, > Can someone pls help me on how to make this bash script? > I want to monitor a process, and then when the process (for some reason) dies, > the script will start the process again. > Thank you, > -- > Fajar Priyanto | Reg'd Linux User #327841 | Linux tutorial > http://linux2.arinet.org > 18:39:44 up 10:21, 2.6.16-1.2111_FC5 GNU/Linux > Let's use OpenOffice. http://www.openoffice.org > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >-- Cleber P. de Souza