monit-general
[Top][All Lists]
Advanced

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

Re: Re: question


From: Christian Hopp
Subject: Re: Re: question
Date: Tue, 2 Sep 2003 16:12:45 +0200 (CEST)

On Tue, 2 Sep 2003, [GB2312] ƽÕðÓî wrote:

Hi!

> 2. For example, I have a programme named '/root/outgate',I want to
> moniter my programme through monit ,How do I modify the shell
> programme you supplied for me ?

see below...

> 3. Can you introduce its work function simply for me ?

a) you start your program as usual

b) you find out the pid of the program afterwards (listing posted
   below) or you predict it before hand (listing posted in last mail)

> 4. The emails I sent to your news group all were returned !

I am not sure if you need to subscribe to the list if you want to post
to it.  Its a mailing list... not a news group.


To the program...

Simplest way is, in case your program is not detaching itself:

---- start ---- e.g. /etc/init.d/outgate ----
#!/bin/bash

case $1 in
     start)
         /root/outgate &
         pgrep -P $$ -f /root/outgate > /var/run/outgate.pid
         ;;
     stop)
         kill `cat /var/run/outgate.pid`
         ;;
     *)
esac
---- stop ---- e.g. /etc/init.d/outgate ----

In case your program is detaching itself things are a little bit more
complicated... but this might work...

---- start ---- e.g. /etc/init.d/outgate ----
#!/bin/bash

case $1 in
     start)
         /root/outgate
         pgrep -P 1 -f /root/outgate > /var/run/outgate.pid
         ;;
     stop)
         kill `cat /var/run/outgate.pid`
         ;;
     *)
esac
---- stop ---- e.g. /etc/init.d/outgate ----

Christian Hopp


-- 
Christian Hopp                                email: address@hidden
Institut für Elektrische Informationstechnik             fon: +49-5323-72-2113
TU Clausthal, Leibnizstr. 28, 38678 Clausthal-Zellerf.   fax: +49-5323-72-3197
                             pgpkey: https://www.iei.tu-clausthal.de/pgp-keys/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]