[Top][All Lists]

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

Re: [monit] java daemons

From: Martin Pala
Subject: Re: [monit] java daemons
Date: Thu, 14 Aug 2008 19:25:33 +0200


here is short howto in 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/
        start = "/bin/xyz start"
        stop = "/bin/xyz stop"

          --8<--- (cut here)

          export JAVA_HOME=/usr/local/java/
          export DISPLAY=localhost:0.0

          case $1 in
           echo $$ > /tmp/;
           exec 2>&1 java -cp ${CLASSPATH} org.something.with.main \
           kill `cat /tmp/` ;;
           echo "usage: xyz {start|stop}" ;;
          --8<---- (cut here)

the example contains the stop method as well (kill `cat /tmp/`).


P.S. we plan to add the possibility to control the services without the pidfile need as well (lot of users asked for it).

On Aug 14, 2008, at 11:14 AM, address@hidden wrote:

Hello Martin,

Thanks a lot for your good work.

I work in a VAS company. We have developed a few java daemons.
Monit is based on processID, my daemons do not have pid.
I understand that I should create a rapper scripts

One of my daemons is called, say xyz, locate in /app/japp/

In my monitrc i should have someting like

check process xyz with pidfile /tmp/
        start = "java /app/japp/xyz"
        stop = "  ???? stop"
I cant figure out how to create
/tmp/ and hoe to start or stop it in monit.

with regards

To unsubscribe:

reply via email to

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