My goal is to check if a webapp is running by checking it's HTTP request header. All of that check is stuck in a shell script that looks like this:
Playing around with it I can see that it works fine at least from in bash. The thing is that when I tell monit to run it like this:
check program SCN_PROD_Web_Application with path "/usr/local/bin/appcheck.sh"
if status != 0 then alert
It does seem to do so but then report and error saying that it failed. In the status UI it says:
Status Status failed
Monitoring mode active
Monitoring status Monitored
Existence If doesn't exist 1 times within 1 cycle(s) then restart else if
succeeded 1 times within 1 cycle(s) then alert
Data collected Fri, 04 May 2012 18:09:49
Last started Not yet started
Last Exit value N/A
Test Exit value if exit value != 0 within 600 seconds then alert
Which kind of looks like it never ran.
Reading the docs I think I'm doing it right, but I just proved myself wrong.
What am I doing wrong here guys?
GNU bash, version 3.2.25
Linux STAGING-centos-5.5 184.108.40.206 #8 SMP Mon Sep 20 15:54:33 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux