monit-general
[Top][All Lists]
Advanced

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

Re: clamav-milter's pid


From: Martin Pala
Subject: Re: clamav-milter's pid
Date: Fri, 07 Apr 2006 23:01:13 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20060205 Debian/1.7.12-1.1



Mike Pepe wrote:
Martin Pala wrote:

Hi,

see monit FAQ - example:

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)


Martin



I just kinda tried something like that.

In the script that starts clamav-milter, I did a little cat/cut thing to remove the - and write a new pid file. But, even when using that pid file, monit still thinks clamav-milter is not running.

-Mike


... try to compare the pid in the file and the pid of the running process - is it equal?

Martin







reply via email to

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