monit-general
[Top][All Lists]
Advanced

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

Re: [monit] Monit wont start/stop any processes


From: Jan-Henrik Haukeland
Subject: Re: [monit] Monit wont start/stop any processes
Date: Mon, 17 Aug 2009 08:32:10 +0200

Monit sets a very spartan PATH for programs it executes for security reasons, as mentioned in the FAQ and in the manual. However, date should be part of the PATH and I'm not sure why this does not work for you. To be sure, do use full paths in the scripts and file so you know which file you write to, such as,

#!/bin/bash
/bin/date >> /tmp/datetest.txt

For good measure also set the execute bit on the script using 'chmod 755 /home/edforceps/bashdate.sh'

On 17. aug.. 2009, at 06.51, Vaughan Magnusson wrote:

Thanks Jan-Henrik,

I've adjusted the stop directive to be as follows:

        stop = "/home/edforceps/bashdate.sh"



Just to be clear, I'm actually trying to monitor backgroundrb, but when the start/stop directives weren't working, I tried to see if I could get *anything* to work. This is why I'm using bashdate.sh, which as the following contents

#!/bin/bash
date >> datetest.txt
echo 'ok'

Once I call 'monit stop all' I check datetest.txt to see if the current date has been appended. I cannot get this to work.

When I execute 'monit stop all' I get the following in the log.


[PDT Aug 16 21:30:57] debug : stop service 'backgroundrb_11006' on user request
[PDT Aug 16 21:30:57] info     : monit daemon at 29750 awakened
[PDT Aug 16 21:30:57] info     : Awakened by User defined signal 1
[PDT Aug 16 21:30:57] debug    : stop service 'ps9844' on user request
[PDT Aug 16 21:30:57] info     : monit daemon at 29750 awakened
[PDT Aug 16 21:30:57] info : 'backgroundrb_11006' stop: /home/ user/bashdate.sh
[PDT Aug 16 21:31:27] error    : 'backgroundrb_11006' failed to stop
[PDT Aug 16 21:31:31] info     : 'backgroundrb_11006' stop action done
[PDT Aug 16 21:31:36] info     : 'ps9844' stop action done

This is actually what i expect, (as the pid that is being monitored still points to an existing process), however there is no evidence of the bashdate.sh actually being run - ie, the current date has not been appended to datetest.txt.

Does anyone know of a simple hello world like experiment I can use to see if monit itself is working? or am I missing something here?

Cheers,
Vaughan.

ps. here are my server details: Linux version 2.6.22.19-xeon-vserver- grsec2.1.11-vs2.2.0.7 (address@hidden) (gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)) #1 SMP Fri Aug 14 23:58:13 PDT 2009
pps. monit lives in /home/user/bin/


On 17/08/2009, at 14:50 PM, Jan-Henrik Haukeland wrote:


On 17. aug.. 2009, at 01.05, Vaughan Magnusson wrote:

  stop = "/bin/bash /home/user/simple_script.sh"

You don't have to start bash to run /home/user/simple_script.sh if it is a proper script. That is, if the file calls an interpreter in its first line such as #!/bin/bash. If you want to write shell commands directly in the start or stop entry you need to start a shell.

To run a script:

stop = "/home/user/simple_script.sh"

To write a statements directly in the stop command:

stop = "/bin/bash -c '<your bash commands here>'"



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

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





reply via email to

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