openfire.init.d 1.62 KB
Newer Older
1
#!/bin/sh
Matt Tucker's avatar
Matt Tucker committed
2 3 4 5 6 7 8 9
#
#		Written by Miquel van Smoorenburg <miquels@cistron.nl>.
#		Modified for Debian 
#		by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
# Version:	@(#)skeleton  1.9  26-Feb-2001  miquels@cistron.nl
#

10 11 12
JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
PATH=/sbin:/bin:/usr/sbin:/usr/bin:$JAVA_HOME/bin
DAEMON=$JAVA_HOME/bin/java
Matt Tucker's avatar
Matt Tucker committed
13 14
NAME=openfire
DESC=openfire
15
DAEMON_DIR=/usr/share/openfire
Matt Tucker's avatar
Matt Tucker committed
16 17 18 19
DAEMON_LIB=${DAEMON_DIR}/lib

test -x $DAEMON || exit 0

Matt Tucker's avatar
Matt Tucker committed
20 21 22
# Include openfire defaults if available
if [ -f /etc/default/openfire ] ; then
	. /etc/default/openfire
Matt Tucker's avatar
Matt Tucker committed
23 24
fi

Matt Tucker's avatar
Matt Tucker committed
25 26
DAEMON_OPTS="-server -DopenfireHome=${DAEMON_DIR} \
 -Dopenfire.lib.dir=${DAEMON_LIB} -classpath ${DAEMON_LIB}/startup.jar\
Matt Tucker's avatar
Matt Tucker committed
27 28
 -jar ${DAEMON_LIB}/startup.jar $DAEMON_OPTS"

29 30 31 32 33 34 35 36 37 38 39 40 41
#set -e

#Helper functions
start() {
        start-stop-daemon --start --quiet --background --make-pidfile \
                --pidfile /var/run/$NAME.pid --chuid openfire:openfire \
                --exec $DAEMON -- $DAEMON_OPTS
}

stop() {
        start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
		--exec $DAEMON --retry 4
}
Matt Tucker's avatar
Matt Tucker committed
42 43 44 45

case "$1" in
  start)
	echo -n "Starting $DESC: "
46
	start
Matt Tucker's avatar
Matt Tucker committed
47 48 49 50
	echo "$NAME."
	;;
  stop)
	echo -n "Stopping $DESC: "
51
	stop
Matt Tucker's avatar
Matt Tucker committed
52 53 54 55 56 57 58 59 60
	echo "$NAME."
	;;
  restart|force-reload)
	#
	#	If the "reload" option is implemented, move the "force-reload"
	#	option to the "reload" entry above. If not, "force-reload" is
	#	just the same as "restart".
	#
	echo -n "Restarting $DESC: "
61 62 63 64 65 66
	#set +e
	stop
	#set -e
	#sleep 1
	start	
	
Matt Tucker's avatar
Matt Tucker committed
67 68 69 70 71 72 73 74 75 76 77
	echo "$NAME."
	;;
  *)
	N=/etc/init.d/$NAME
	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0
78