monit-general
[Top][All Lists]
Advanced

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

Re: question


From: Christian Hopp
Subject: Re: question
Date: Mon, 1 Sep 2003 11:53:07 +0200 (CEST)

On Mon, 1 Sep 2003, [GB2312] ƽÕðÓî wrote:

Hi!

> I have a program that does not create its own pid file. Since
> monit requires all programs to have a pid file, what do I do?
>
> How can let the monit monitor my program ?

Our FAQ has a short guide describing how to to accomplish that...

---- [FAQ.txt] ----
3. Q: I have a program that does not create its own pid file. Since
      monit requires all programs to have a pid file, what do I do?

   A: Create a wrapper script and have the script create a pid file
      before it starts the program. Below you will find an example
      script for starting an imaginary program (a Java program in this
      case).  Assuming that the script is saved in a file called
      /bin/xyz, you can call this script from monit by using the
      following in monitrc:

      check process xyz with pidfile /tmp/xyz.pid
        start = "/bin/xyz start"
        stop = "/bin/xyz stop"


          --8<--- (cut here)

          #!/bin/bash
          export JAVA_HOME=/usr/local/java/
          export DISPLAY=localhost:0.0
          CLASSPATH=ajarfile.jar:.

          case $1 in
           start)
           echo $$ > /tmp/xyz.pid;
           exec 2>&1 java -cp ${CLASSPATH} org.something.with.main \
           1>/tmp/xyz.out
           ;;
          stop)
           kill `cat /tmp/xyz.pid` ;;
          *)
           echo "usage: xyz {start|stop}" ;;
          esac

          --8<---- (cut here)
---- [FAQ.txt] ----

> if my program name is outgate(Programming Language is C ). beacuse
> my programe have some promble, when outgate is not working, i want
> monit to restart outgate.
>
> check outgate with pidfile /tmp/outgate.pid
>         start="/root/outgate start"
>         stop ="/root/outgate stop"

This looks sufficient for you program.  Please have a look in monit's
man-page for further information.  You might want to set some global
setting like "set daemon 120" to specify the time between the checks.

Please use our mailing list address@hidden)
for further questions, because there you can reach the whole monit
team and a community of many users.

Bye,

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]