I am travelling right now - will try it as soon as I have access to the
system.

 

From: [email protected]
[mailto:[email protected]] On Behalf
Of Martin Pala
Sent: Tuesday, March 22, 2011 2:07 AM
To: This is the general mailing list for monit
Subject: Re: Problem stopping services

 

Hello,

 

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

 

You can log the script output this way:

 

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

 

 

Regards,

Martin

 

 

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 stopdaemon.sh which looks as follows:

 

#!/bin/sh

#stop a php daemon

mydaemon="$1.php"

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/stopdaemon.sh 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:
http://lists.nongnu.org/mailman/listinfo/monit-general

 

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

Reply via email to