#!/bin/sh # # Script to start tomcat. Place in the appropriate subdirectory # in /etc for your system if you want tomcat to automatically # start on bootup. # # This script was written for execution on a Solaris system. # Modify appropriately for your situation. # # This particular script is set up to run tomcat as user 'nobody'. # If you are using a different user, modify as necessary. # CATALINA_HOME=/PATH/TO/packages/tomcat/current export CATALINA_HOME JAVA_HOME=/PATH/TO/java/current export JAVA_HOME case "$1" in start) cmdtext="starting" echo "tomcat $cmdtext." status=`su nobody ${CATALINA_HOME}/bin/catalina.sh start 2>&1` ;; restart) cmdtext="restarting" echo "tomcat $cmdtext." status=`su nobody ${CATALINA_HOME}/bin/catalina.sh stop ; sleep 10 ; su nobody ${CATALINA_HOME}/bin/catalina.sh start 2>&1` ;; stop) cmdtext="stopping" echo "tomcat $cmdtext." status=`su nobody ${CATALINA_HOME}/bin/catalina.sh stop 2>&1` ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 ;; esac if [ $? != 0 ]; then echo "$status" exit 1 fi exit 0