Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

#!/bin/bash
#
# tomcat
#
# chkconfig:
# description: Start up the Tomcat7 servlet engine.
# Source function library.
. /etc/init.d/functions
RETVAL=$?
CATALINA_HOME="/usr/share/tomcat7"
case "$1" in
start)
if [ -f $CATALINA_HOME/bin/startup.sh ];
then
echo $"Starting Tomcat"
/bin/su -s /bin/bash tomcatUser $CATALINA_HOME/bin/startup.sh
fi
;;
stop)
if [ -f $CATALINA_HOME/bin/shutdown.sh ];
then
echo $"Stopping Tomcat"
/bin/su tomcatUser $CATALINA_HOME/bin/shutdown.sh
fi
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1
;;
esac
exit $RETVAL

run  sudo chmod 755 /etc/init.d/tomcat and sudo update-rc.d tomcat defaults

Then run sudo service tomcat start and sudo service tomcat stop respectively

...