[Top][All Lists]

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

[monit] RE: monit daemon does not restart the process

From: Divakar Singh
Subject: [monit] RE: monit daemon does not restart the process
Date: Tue, 11 Mar 2008 10:55:39 +0530


Please see if anybody has faced a similar problem.




From: Divakar Singh
Sent: Friday, March 07, 2008 6:05 PM
To: 'address@hidden'
Subject: monit daemon does not restart the process




Problem summary: when the process monitored by monit dies unexpectedly, monit is unable to restart it (when monit is running in daemon mode). Whereas, It starts the process very well using “monit start”.


Problem Discription:


I am using monit 3.2 binary on solaris (I have not compiled and installed monit due to some system configuration issues. I am not aware whether monit needs anything else to run properly. When I run the monit binary I have, it seems to run fine.).


I want to make use of monit to monitor processes related to my project.


Since none of my programs create pid file, I have used wrapper script to first dump the pid to a pid file, then spawning the program from same shell.


Script (








export PATH


if [ $# -lt 3 ]


echo "usage: $0 [program] [start/stop] [pid file name]"



echo "executing: $1 $2 $3"


case $2 in



            echo in start > a.txt

        rm "$3"     2 >& /dev/null

            echo after removing >>a.txt

        echo $$ > "$3"

            echo after pid dump, before exec >>a.txt

        exec  $1 > $1.log 2>&1  

            echo after exec > a.txt ;;




            PID=`cat $3`


            if [ $PID != "" ]


              kill $PID


              echo "PID for $3 not found" >> monitlog



        rm "$3"    2 >& /dev/null;;



        echo "usage: $0 [program] [start/stop] [pid file]" ;;








my monitrc file is:






set logfile "/local/f880-5disk2/home/globallogic/AMS/Int_TestBed_2/PSD_Manager/monitlog"

set daemon 120

set mailserver


check WPG with pidfile /local/f880-5disk2/home/globallogic/AMS/Int_TestBed_2/PSD_Manager/

start program = "/local/f880-5disk2/home/globallogic/AMS/Int_TestBed_2/PSD_Manager/ Int2_WPG_ams0.5.16 start"

stop program = "/local/f880-5disk2/home/globallogic/AMS/Int_TestBed_2/PSD_Manager/  Int2_WPG_ams0.5.16 stop"


alert address@hidden






When I run monit from command line like:


$ ./monit start WPG


It starts the process. Also,


$ ./monit stop WPG


Stops the process.




$ ./monit start


Works fine. i.e., it starts the process listed in monitrc.


But, when I run the monit in daemon mode like


$ ./monit


Now if the process monit is watching is killed, it is unable to restart the process.


The error message I can see in monitlog file is:


[GMT Mar  7 05:19:17] start: (WPG) /local/f880-5disk2/home/globallogic/AMS/Int_TestBed_2/PSD_Manager/

[GMT Mar  7 05:19:27] monit: Warning process 'WPG' was not started


And the process is indeed not started.


I keep on getting emails like:



Program WPG restarted


      Date: Fri Mar  7 05:19:06 2008

      Host: unknown


Your faithful employee,



Reason: Process is not running.



But the process is not started.


Kindly help, this is very critical.


Thanks in anticipation,


reply via email to

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