monit-general
[Top][All Lists]
Advanced

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

Re: syntax errors with “check program” fo r custom bash script


From: s contini
Subject: Re: syntax errors with “check program” fo r custom bash script
Date: Fri, 14 Jun 2013 11:38:41 -0700 (PDT)

> uname -a
> Linux my.host.name.here.com 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:34:28 EST 2008 x86_64 x86_64 x86_64 GNU/Linux

> bash --version
> GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)



From: sven falempin <address@hidden>
To: s contini <address@hidden>; This is the general mailing list for monit <address@hidden>
Sent: Friday, June 14, 2013 10:58 AM
Subject: Re: syntax errors with “check program” for custom bash script

uname -a ?
which bash ?


<</usr/bash>>


On Fri, Jun 14, 2013 at 1:32 PM, s contini <address@hidden> wrote:

I am getting syntax errors when I try to check the exit status of a bash script using monit's "check program". If I run the bash script manually, it doesn't error. But if I do monit reload with my monit check program in the config, monit gives me errors.
Here's my current monit .conf file --
check program myscript with path "/etc/monit.d/script_to_run.sh"
  if status != 0 then alert
If I change it to this to make sure monit uses bash to parse the file...
check program myscript with path "/usr/bash /etc/monit.d/script_to_run.sh"
  if status != 0 then alert
Then I get this error
Warning: Program does not exist: '"/bin/bash /etc/monit.d/script_to_run.sh"'

Even if I have basic test script stuff in script_to_run.sh I still get errors:
#!/bin/bash
exit 0
Monit will complain --
Error: syntax error 'exit'
If I have this in script_to_run.sh:
#!/bin/bash
echo "hello"
Monit will complain --
Error: syntax error 'echo'
For reference -- I have monit 5.4, have followed the "check program" example in the man monit doc, and am able to configure/use monit "check process..." just fine on the same server. And yeah, bash scripts run fine if not through monit...
 
Thoughts? 

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



--
---------------------------------------------------------------------------------------------------------------------
() ascii ribbon campaign - against html e-mail 
/\ 



reply via email to

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