b6a0d1
#!/bin/bash
b6a0d1
b6a0d1
if [ "$1" = "version" ]; then
b6a0d1
  . /usr/libexec/tomcat/preamble
b6a0d1
  exec ${JAVACMD} -classpath ${CATALINA_HOME}/lib/catalina.jar \
b6a0d1
    org.apache.catalina.util.ServerInfo
b6a0d1
fi
b6a0d1
b6a0d1
SRV="tomcat"
b6a0d1
if [ -n "$2" ]; then
b6a0d1
  SRV="tomcat@$2"
b6a0d1
fi
b6a0d1
b6a0d1
if [ "$1" = "start" ]; then
b6a0d1
  systemctl start ${SRV}.service
b6a0d1
elif [ "$1" = "stop" ]; then
b6a0d1
  systemctl stop ${SRV}.service
b6a0d1
elif [ "$1" = "version" ]; then
b6a0d1
  ${JAVACMD} -classpath ${CATALINA_HOME}/lib/catalina.jar \
b6a0d1
    org.apache.catalina.util.ServerInfo
b6a0d1
else
b6a0d1
  echo "Usage: $0 {start|stop|version} [server-id]"
b6a0d1
  exit 1
b6a0d1
fi