[Top][All Lists]

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

Re: Problem stopping services

From: Martin Pala
Subject: Re: Problem stopping services
Date: Tue, 22 Mar 2011 09:06:40 +0100


please can you add the start/stop statement which you use for the in monit configuration file?

You can log the script output this way:

stop program = "/bin/bash -c '/root/ staledaemon >>/tmp/monit_stop.out 2>&1'"


On Mar 22, 2011, at 12:36 AM, Benjamin Krajmalnik wrote:

I am having a strange issue stopping a group of services (daemons written in PHP).
OS is FreeBSD 8.1, monit version is 5.2.4.
I have tried various approaches.
I tried running it through a which looks as follows:
#stop a php daemon
killstring="/bin/ps -aux | /usr/bin/grep ‘php $mydaemon’ | /usr/bin/grep -v stopdaemon | /usr/bin/grep -v grep | /usr/binawk ' {print \$2}' | /usr/bin/xargs /bin/kill -s KILL && sleep 10"
eval $killstring
Running this from the command line works fine.  Running it from within monit fails – not sure why.
Checking the processes which run as the stop script is called I see the following, which indicates it was called properly and with root access:
root      61480  0.6  0.0  8264  1784  ??  S     5:28PM   0:00.01 /bin/sh /root/ staledaemon
root      60597  0.0  0.1 99664 21116  ??  Ss    5:27PM   0:00.03 /usr/local/bin/php staledaemon.php
root      60598  0.0  0.1 99664 21200  ??  I     5:27PM   0:00.01 /usr/local/bin/php staledaemon.php
root      61620  0.0  0.1 99664 21204  ??  S     5:28PM   0:00.00 /usr/local/bin/php staledaemon.php
Launching the script from the command line works fine.  Any ideas will be deeply appreciated, since it is critical that I be able to stop the processes.
I monitor the number of processes which are running, and if they fall below a certain level I need to restart the service, since each process in the service has its own functionality.
Any assistance will be deeply appreciated.
To unsubscribe:

reply via email to

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