I have installed Tomcat 7 on Ubuntu 12.04 LTS which runs on an Amzon EC2 instance. Now I wish tomcat should restart automatically on system reboot.
I read this blog which suggest adding below script to /etc/init.d/tomcat7:
# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid
case $1 in
start)
sh /usr/share/tomcat7/bin/startup.sh
;;
stop)
sh /usr/share/tomcat7/bin/shutdown.sh
;;
restart)
sh /usr/share/tomcat7/bin/shutdown.sh
sh /usr/share/tomcat7/bin/startup.sh
;;
esac
exit 0
and issue the following commands:
sudo chmod 755 /etc/init.d/tomcat7
sudo ln -s /etc/init.d/tomcat7 /etc/rc1.d/K99tomcat
sudo ln -s /etc/init.d/tomcat7 /etc/rc2.d/S99tomcat
sudo /etc/init.d/tomcat7 restart
My Questions
- The tomcat7 already has script in it, where do we have to paste the suggested script?
- Is the suggested procedure correct?
Could you look up 'runlevels' and 'network interface' terms on google? I'm happy to help with other things but not so much with Googling trivial stuff for others.
And about the other question: my script is meant to replace /etc/init.d/tomcat7.
– Marcin Kaminski Dec 07 '12 at 00:54/etc/init.d/tomcat7in my system is similar to the file here https://gist.github.com/942150. Should I remove all the content from the file and paste your script or paste it at some place in the already written script. – Gaurav Agarwal Dec 07 '12 at 11:56Use whichever you like, the important thing is to understand what the script does when you paste it.
– Marcin Kaminski Dec 07 '12 at 14:23OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "http-bio-443-exec-7". – Dec 16 '14 at 15:21