[Top][All Lists]

[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 (Windows/20071031)

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 file, it will use only the last created pid for the process. Then I get a 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/
   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


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/
The start up script(startAPRScvt) is currently:

cd /home/aprsd2
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:

To unsubscribe:

Attachment: teresa_m_havel.vcf
Description: Vcard

reply via email to

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