Code Snippet

Just another Code Snippet site

[Linux] Start Tomcat (Jenkins) at boot time

Create script /etc/init.d/tomcat :

#Tomcat auto-start
#description: Auto-starts tomcat
#processname: tomcat
#pidfile: /var/run/tomcat.pid

#this path should point to your JAVA_HOME Directory
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64
case $1 in

start)
  sh /opt/tomcat/bin/startup.sh
  ;;

stop)  
  sh /opt/tomcat/bin/shutdown.sh
  ;;

restart)
  sh /opt/tomcat/bin/shutdown.sh
  sh /opt/tomcat/bin/startup.sh
  ;;
esac
   
exit 0

Chmod + boot time definition :

chmod +x /etc/init.d/tomcat
update-rc.d tomcat defaults


Comments are currently closed.