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