[pkg-java] r2650 - trunk/tomcat5.5/debian
Marcus Better
marcusb-guest at costa.debian.org
Mon Oct 23 11:29:50 UTC 2006
Author: marcusb-guest
Date: 2006-10-23 11:29:49 +0000 (Mon, 23 Oct 2006)
New Revision: 2650
Modified:
trunk/tomcat5.5/debian/tomcat5.5.init
Log:
LSB compliance.
Modified: trunk/tomcat5.5/debian/tomcat5.5.init
===================================================================
--- trunk/tomcat5.5/debian/tomcat5.5.init 2006-10-23 11:28:11 UTC (rev 2649)
+++ trunk/tomcat5.5/debian/tomcat5.5.init 2006-10-23 11:29:49 UTC (rev 2650)
@@ -1,18 +1,35 @@
-#! /bin/sh -e
+#!/bin/sh
#
# /etc/init.d/tomcat5.5 -- startup script for the Tomcat 5 servlet engine
#
# Written by Miquel van Smoorenburg <miquels at cistron.nl>.
# Modified for Debian GNU/Linux by Ian Murdock <imurdock at gnu.ai.mit.edu>.
# Modified for Tomcat by Stefan Gybas <sgybas at debian.org>.
+#
+### BEGIN INIT INFO
+# Provides: tomcat
+# Required-Start: $local_fs $remote_fs $network
+# Required-Stop: $local_fs $remote_fs $network
+# Should-Start: $named
+# Should-Stop: $named
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start Tomcat.
+# Description: Start the Tomcat servlet engine.
+### END INIT INFO
-PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+set -e
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
NAME=tomcat5.5
-DESC="Tomcat 5 servlet engine"
+DESC="Tomcat servlet engine"
CATALINA_HOME=/usr/share/$NAME
DAEMON=$CATALINA_HOME/bin/catalina.sh
DEFAULT=/etc/default/$NAME
+. /lib/lsb/init-functions
+. /etc/default/rcS
+
# The following variables can be overwritten in $DEFAULT
# Run Tomcat 5 as this user ID
@@ -40,17 +57,8 @@
test -f $DAEMON || exit 0
-if [ `id -u` -ne 0 ]; then
- echo "Not starting/stopping $DESC, you are not root."
- exit 4
-fi
+[ -z "$TOMCAT5_USER" ] && TOMCAT5_USER=tomcat55
-if [ -z "$TOMCAT5_USER" ]; then
- echo "Not starting/stopping $DESC as configured (TOMCAT5_USER is"
- echo "empty in $DEFAULT)."
- exit 0
-fi
-
# Look for the right JVM to use
for jdir in $JDK_DIRS; do
if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
@@ -94,19 +102,16 @@
case "$1" in
start)
if [ -z "$JAVA_HOME" ]; then
- echo "Could not start $DESC because no Java Development Kit"
- echo "(JDK) was found. Please download and install JDK 1.3 or higher and set"
- echo "JAVA_HOME in $DEFAULT to the JDK's installation directory."
- exit 0
+ log_failure_msg "Not starting Tomcat: no Java Development Kit found."
+ exit 1
fi
if [ ! -d "$CATALINA_BASE/conf" ]; then
- echo "Not starting Tomcat 5: Invalid CATALINA_BASE specified in $DEFAULT"
+ log_failure_msg "Not starting Tomcat: invalid CATALINA_BASE specified."
exit 1
fi
- echo -n "Starting $DESC using Java from $JAVA_HOME: "
-
+ log_daemon_msg "Starting $DESC" "$NAME"
if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
--user $TOMCAT5_USER --startas "$JAVA_HOME/bin/java" \
>/dev/null; then
@@ -147,17 +152,17 @@
su -p -s /bin/sh $TOMCAT5_USER \
-c "\"$DAEMON\" start $STARTUP_OPTS" \
>> "$CATALINA_BASE/logs/catalina.out" 2>&1
- echo "$NAME."
else
- echo "(already running)."
+ log_progress_msg "(already running)"
fi
+ log_end_msg 0
;;
stop)
- echo -n "Stopping $DESC: "
+ log_daemon_msg "Stopping $DESC" "$NAME"
if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
--user "$TOMCAT5_USER" --startas "$JAVA_HOME/bin/java" \
>/dev/null; then
- echo "(not running)."
+ log_progress_msg "(not running)"
else
su -p -s /bin/sh $TOMCAT5_USER -c "\"$DAEMON\" stop" \
>/dev/null 2>&1 || true
@@ -167,18 +172,18 @@
--pidfile "$CATALINA_PID" --user "$TOMCAT5_USER" \
--startas "$JAVA_HOME/bin/java" >/dev/null; do
sleep 1
- echo -n "."
+ log_progress_msg "."
TOMCAT5_SHUTDOWN=`expr $TOMCAT5_SHUTDOWN - 1` || true
if [ $TOMCAT5_SHUTDOWN -le 0 ]; then
- echo -n " (killing) "
+ log_progress_msg "(killing)"
start-stop-daemon --stop --signal 9 --oknodo \
--quiet --pidfile "$CATALINA_PID" \
--user "$TOMCAT5_USER"
fi
done
rm -f "$CATALINA_PID" "$CATALINA_BASE/logs/catalina.out"
- echo "$NAME."
fi
+ log_end_msg 0
;;
status)
if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
@@ -186,20 +191,19 @@
>/dev/null; then
if [ -f "$CATALINA_PID" ]; then
- echo "$DESC is not running, but pid file exists."
+ log_success_msg "$DESC is not running, but pid file exists."
exit 1
else
- echo "$DESC is not running."
+ log_success_msg "$DESC is not running."
exit 3
fi
else
- echo -n "$DESC is running with Java pid "
- cat "$CATALINA_PID"
+ log_success_msg "$DESC is running with Java pid $CATALNA_PID"
exit 0
fi
;;
reload)
- echo "Reload is not implemented!" >&2
+ log_failure_msg "Reload is not implemented!"
exit 3
;;
restart|force-reload)
@@ -208,8 +212,8 @@
$0 start
;;
*)
- echo "Usage: /etc/init.d/tomcat5.5 {start|stop|restart|force-reload|status}" >&2
- exit 2
+ log_success_msg "Usage: $0 {start|stop|restart|force-reload|status}"
+ exit 1
;;
esac
More information about the pkg-java-commits
mailing list