All my Ansible Playbooks
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

69 lines
1.2 KiB

#!/bin/bash
#
# Tomcat Startup Script
#
# chkconfig: 2345 80 30
# description: Tomcat Application Server
#
### BEGIN INIT INFO
# Provides: webfort
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop tomcat server
# Description: Tomcat Application server
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
TOMCAT_USER={{ tomcat_user }}
tomcat_pid="$(pgrep -U $TOMCAT_USER java)"
running=$?
start() {
[ "$EUID" != "0" ] && exit 4
su "$TOMCAT_USER" -c "{{ tomcat_home }}/bin/catalina.sh start"
}
stop() {
[ "$EUID" != "0" ] && exit 4
su "$TOMCAT_USER" -c "{{ tomcat_home }}/bin/catalina.sh stop"
}
status() {
echo -n "Tomcat "
if [ -n "$tomcat_pid" ]; then
echo "started"
else
echo "stopped"
fi
return $running
}
# See how we were called.
case "$1" in
start)
[ $running -eq 0 ] && exit 0
start
;;
stop)
[ $running -eq 0 ] || exit 0
stop
;;
restart|force-reload)
stop
sleep 5
start
;;
status)
status
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 2
esac
exit $?