Sophie

Sophie

distrib > Arklinux > devel > i586 > media > main > by-pkgid > 77c5740294fa20110e6f35481d0de412 > files > 2

tomcat-6.0.29-1ark.i586.rpm

#!/bin/sh
#
# Startup script for the Apache Tomcat servlet container
#
# chkconfig: - 86 14
# description: Apache Tomcat is a servlet container.
# processname: catalina.sh
# pidfile: /var/run/tomcat.pid
# config: /etc/sysconfig/tomcat

# Source function library.
. /etc/rc.d/init.d/functions

[ -e /etc/sysconfig/tomcat ] && . /etc/sysconfig/tomcat

prog="Tomcat"
RETVAL=0

start() {
	echo -n $"Starting $prog: "
	daemon --user tomcat /srv/tomcat/bin/catalina.sh start
	RETVAL="$?"
	[ "$RETVAL" = "0" ] && touch /var/run/tomcat.pid
}

stop() {
	daemon --user tomcat /srv/tomcat/bin/catalina.sh stop
	RETVAL="$?"
	[ "$RETVAL" = "0" ] && rm /var/run/tomcat.pid
}

status() {
	PID=`pidofproc tomcat`
	if [ -z "$PID" ]; then
		echo "Tomcat is stopped"
		RETVAL=1
	else
		echo "Tomcat (pid $PID) is running"
		RETVAL=0
	fi
}

case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		stop
		start
		;;
	condrestart)
		if [ -e /var/run/tomcat.pid ]; then
			stop	
			start
		fi
		;;
	status)
		status
		;;
esac

exit $RETVAL