monit-general
[Top][All Lists]
Advanced

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

Re: [monit] Process Generates Two PIDs


From: Teresa Havel
Subject: Re: [monit] Process Generates Two PIDs
Date: Thu, 06 Dec 2007 16:03:08 -0600
User-agent: Thunderbird 2.0.0.9 (Windows/20071031)

Martin,
I thought about splitting the script, but since the process, tcpaprscvt, is the same name for both, when I would create my pid file, it would overwrite and I would end up with just one. But then I looked for some options for the pgrep command and if I use "pgrep -n" to create the tcpaprscvt.pid file, it will use only the last created pid for the process. Then I get a tcpaprscvt.pid file with just one pid in it. I thought this would work because when it sees that process failed, it would run my startAPRScvt script and start both up again. I won't get any duplicate processes because when one of them fails, they both fail.

I put this theory into practice. Then to test it, I killed both tcpaprscvt processes and monit properly recognized the status as, the process does not exist, but then when it came to starting my startAPRScvt script, it doesn't seem to be working. I can run the startAPRScvt script manually and it works, but doesn't run from monit. Here is the pertinent part in my monitrc file:

#
 check process tcpaprscvt with pidfile /var/run/tcpaprscvt.pid
   start program = "/home/aprsd2/startAPRScvt"
#    stop program  = "/etc/init.d/httpd stop"
#
I did not put in a stop program because I didn't think it was needed since I am using a start script and the processes will never need to be stopped by monit. Does monit still need a "stop program" designated"? The "monit -t" gave me "Control file syntax OK".
What could be causing my "start program" to not work? Thanks.



Martin Pala wrote:
You will need to split the startup script to two parts (start each process independently). According to your script, it shouldn't be problem. Monit will watch each process separately

Martin


Teresa Havel wrote:
I have a process, tcpaprscvt, that when it is started, it actually generates two processes with two different pids. It does not create a pid file, so I will be using the suggestion(which I got from your archives) to create a pid file by adding this line at the end of my startup script: pgrep tcparscvt > /var/run/tcpaprscvt.pid
The start up script(startAPRScvt) is currently:

cd /home/aprsd2
UMASK=766
export TZ=CST6CDT
/home/aprsd2/tcpaprscvt -t -p 1 grb localhost 14579 &
/home/aprsd2/tcpaprscvt -t -p 1 crs localhost 14580 &

I works fine to manually restart the script. But as you can see, it actually starts two tcpaprscvt processes which each have their own pid. When I create the pid file, it has two pids in it. Will monit be able to handle this pid file properly? Thanks.

--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general


--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general

Attachment: teresa_m_havel.vcf
Description: Vcard


reply via email to

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