| #!/bin/bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| export NAME="${SERVICE_NAME:-tomcat}" |
| |
| |
| |
| |
| |
| if [ -x "/sbin/runuser" ]; then |
| SU="/sbin/runuser -s /bin/sh" |
| else |
| SU="/bin/su -s /bin/sh" |
| fi |
| |
| |
| TOMCAT_SCRIPT="/usr/sbin/tomcat" |
| |
| |
| TOMCAT_USER="${TOMCAT_USER:-tomcat}" |
| |
| |
| |
| TOMCAT_LOG=/var/log/${NAME}/${NAME}-sysd.log |
| |
| |
| TOMCAT_CFG="/etc/tomcat/tomcat.conf" |
| if [ -r "$TOMCAT_CFG" ]; then |
| . $TOMCAT_CFG |
| fi |
| |
| |
| if [ -r "/etc/sysconfig/${NAME}" ]; then |
| . /etc/sysconfig/${NAME} |
| fi |
| |
| |
| function start() { |
| |
| export CATALINA_PID="/var/run/${NAME}.pid" |
| |
| touch $TOMCAT_LOG 2>&1 |
| if [ "$?" -eq "0" ]; then |
| chown ${TOMCAT_USER}:${TOMCAT_USER} $TOMCAT_LOG |
| fi |
| |
| if [ "$SECURITY_MANAGER" = "true" ]; then |
| ${TOMCAT_SCRIPT} start-security >> $TOMCAT_LOG 2>&1 |
| else |
| ${TOMCAT_SCRIPT} start |
| fi |
| } |
| |
| function stop() { |
| ${TOMCAT_SCRIPT} stop >> $TOMCAT_LOG 2>&1 |
| } |
| |
| |
| case "$1" in |
| start) |
| start |
| ;; |
| stop) |
| stop |
| ;; |
| restart) |
| stop |
| start |
| ;; |
| esac |
| |