monit-general
[Top][All Lists]
Advanced

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

Monit refuse to start/stop a java process


From: pierrick grasland
Subject: Monit refuse to start/stop a java process
Date: Wed, 19 Sep 2007 15:18:28 +0200

Hi,

I'm testing monit for a project, and i'm trying to monit a java process, under a debian etch (monit 4.8.1)

I'm currently using this configuration for my service :

check process easip with pidfile /var/run/easip.pid
        group easip_gr
        start program = "/home/pierrick/easip/easip.sh start"
        stop program = "/home/pierrick/easip/easip.sh stop"
#       if 3 restarts within 5 cycles then timeout  # desactivated for test
        depends on easip_file

check file easip_file with path /home/pierrick/easip/easip.sh
        group easip_gr
        if failed permission 755 then unmonitor

with this script, in order to have a pidfile :

#/bin/sh

easipStart() {
        echo $$ > /var/run/easip.pid
        exec 2>&1 java -jar /home/pierrick/easip/start.jar
}

easipStop() {
        kill -15 `cat /var/run/easip.pid`
        echo "" >/var/run/easip.pid
}

case $1 in
 start)
        easipStart
        ;;
 stop)
        easipStop
        ;;

 restart)
        easipStop
        sleep 3
        easipStart
        ;;

 *)
        echo "usage: easip.sh {start|stop|restart}" ;;
esac


With this configuration, I can check the status of my process, ie running or not, with the web interface.

Process 'easip'
  status                            running
  monitoring status                 monitored
  pid                               23418
  parent pid                        19170
  uptime                            1m
  childrens                         0
  memory kilobytes                  76484
  memory kilobytes total            76484
  memory percent                    3.6%
  memory percent total              3.6%
  cpu percent                       0.0%
  cpu percent total                 0.0%
  data collected                    Wed Sep 19 15:41:38 2007

In order to verify my script (needed for pidfile), i monitor the file

File 'easip_file'
  status                            accessible
  monitoring status                 monitored
  permission                        755
  uid                               0
  gid                               1000
  timestamp                         Wed Sep 19 15:10:48 2007
  size                              389 B
  data collected                    Wed Sep 19 15:41:38 2007

So, as you can see, i have all access to my script and monit can check the pid. But, when i try to stop / start my process with web interface, monit don't pass these operations :

Sep 19 15:47:08 localhost monit[23566]: 'easip' stop: /home/pierrick/easip/easip.sh
Sep 19 15:47:29 localhost monit[23566]: 'easip' failed to stop

Sep 19 15:50:29 localhost monit[23566]: 'easip' process is not running
Sep 19 15:50:29 localhost monit[23566]: 'easip' trying to restart
Sep 19 15:50:29 localhost monit[23566]: monit: pidfile `/var/run/easip.pid' does not contain a valid pidnumber
Sep 19 15:50:29 localhost monit[23566]: monit: pidfile `/var/run/easip.pid' does not contain a valid pidnumber
Sep 19 15:50:29 localhost monit[23566]: 'easip' start: /home/pierrick/easip/easip.sh
Sep 19 15:50:29 localhost monit[23566]: monit: pidfile `/var/run/easip.pid' does not contain a valid pidnumber
Sep 19 15:50:29 localhost last message repeated 2 times
Sep 19 15:50:29 localhost monit[23566]: 'easip' failed to start
Sep 19 15:50:30 localhost monit[23566]: monit: pidfile `/var/run/easip.pid' does not contain a valid pidnumber

My script works fine and I don't have any clue about what to do next in order to make monit do his job.

Thank you,
--
Grasland Pierrick


reply via email to

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