monit-general
[Top][All Lists]
Advanced

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

Re: clamav-milter's pid


From: Mike Pepe
Subject: Re: clamav-milter's pid
Date: Fri, 07 Apr 2006 16:58:40 -0400
User-agent: Thunderbird 1.5 (Windows/20051201)

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




reply via email to

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