Cron job to restart Tomcat when it crashes

350 views
Skip to first unread message

Michael Wood

unread,
Dec 17, 2015, 11:29:18 PM12/17/15
to Lucee
My Lucee server is crashing because I haven't quite figured out how to configure it properly. As a temporary solution I have written a bash script to run as a cron job every 5 minutes. This should check if TC is running and accessible and restart Lucee/TC if not. I would appreciate constructive comments or improvements. I have the website running on port 80 on Tomcat (no Apache). This is running as a system cron.

#!/bin/bash
if sudo netstat -tulpen | grep ":80 " > /dev/null 2>&1  &&  ps -ef | grep tomcat | grep java > /dev/null 2>&1 
then
        echo "Tomcat Running" > /dev/null
else
        echo "Tomcat Stopped" > /dev/null
sudo /opt/lucee/lucee_ctl restart
fi

Jon Clausen

unread,
Dec 18, 2015, 8:19:38 AM12/18/15
to lu...@googlegroups.com
Installing Fusion Reactor (http://www.fusion-reactor.com/ ) on this server would help you a great deal and it can handle the restarts after crashes.  It will also give you a ton of useful information that will help you in tuning your server, along with identifying bottlenecks in your application.
--
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/d149870b-6bf7-46f7-a9a9-c0d6b079faff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages