Linux Upstart script for tomcat



#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80


#Uncomment services you would like to start 
JAVA_HOME=/opt/jrockit

export JAVA_HOME

PATH=$JAVA_HOME/bin:$PATH

export PATH

TOMCAT_HOME=/opt/jweb/daemon/tomcat/bin

export AMQ_HOME=/opt/jweb/daemon/amq58/bin

export LCJMS_HOME=/opt/jweb/daemon/jmsd


case $1 in
start)
/bin/su tom  -c $AMQ_HOME/startup.sh
/bin/su tom  -c $TOMCAT_HOME/startup.sh
#/bin/su tom  -c $LCJMS_HOME/startup.sh
;; 
stop)   
/bin/su tom  -c $TOMCAT_HOME/shutdown.sh
;; 
restart)
/bin/su tom  -c $TOMCAT_HOME/shutdown.sh
/bin/su tom  -c $TOMCAT_HOME/startup.sh
;; 
esac    

exit 0


## Once you create this script run following command on ubuntu to make it available on boot


For Ubuntu::
#update-rc.d <scriptname> defaults

For RHEL/Centos/OEL

Step 1: 

chkconfig --add <scriptname>

Step 2:
chkconfig --level 234 <scriptname> on
  

Comments

Popular posts from this blog

LLRP XML Messages

Linux Custom startup and shutdown script for java or any server application