I have several Cloudwatch alarms that monitor my different servers on AWS. This is great to catch runaway CPU processes or other server failures. Unfortunately, this doesn’t catch middleware failures.

Some legacy websites we manage still use Coldfusion. We use the open-source CFML engine LUCEE which runs on Tomcat. Problem is, occasionally Lucee will fail but this doesn’t trigger an AWS Cloudwatch alarm. I get an alert from my site monitor Uptime Robot (which offers a free server monitoring service) but I still have to SSH into the server and restart the service, or if I am out I just have to reboot the entire instance which is not ideal.

PHP has permission issues when trying to execute server level commands like restarting services. I wrote a very simple BASH script instead and added a CRON job that runs it every 5 minutes and makes sure CFML pages are still being served.

You might find it useful

Script to check Server HTTP Response

# check if Lucee is running
RESPONSE=$(curl –write-out %{http_code} –silent –output /dev/null www.mysite.com/index.cfm)

echo “Response is $RESPONSE”

if ((“$RESPONSE” > “$OK”)); then
mail -s “LUCEE RESTARTED TRIGGER $RESPONSE” *protected email* <<< “lucee  is not responding, attempting restart”
echo “debug – attempting restart”
sudo /opt/lucee/lucee_ctl restart
echo “alls well that ends well, we will check again in 5 minutes”


Once I checked the script, I just added a line in crontab to run it every 5 minutes.

*/5 * * * * /var/devops/test_lucee.sh

Some basic resources on bash are on stackoverflow.

Leave a Reply

Your email address will not be published. Required fields are marked *