libreccm-legacy/tools-legacy/scripts/pkg/bin/init.sh.in

119 lines
2.2 KiB
Bash
Executable File

#!/bin/sh
#
# Startup script for ::PACKAGE::
#
# chkconfig: 345 95 05
# description: Startup script for ::PACKAGE::
#
# Daniel Berrange <berrange@redhat.com>
# Dennis Gregorovic <dgregor@redhat.com>
#
# Source function library.
if [ -x /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
fi
prog=::PACKAGE::
RETVAL=0
# Path to the real launch script
# NB, this script will take care of
# su'ing to the correct user
LAUNCH_SCRIPT=/var/www/::PACKAGE::/bin/run.sh
start() {
echo -n $"Starting $prog: "
if [ -x /etc/rc.d/init.d/functions ]; then
daemon $LAUNCH_SCRIPT start
else
$LAUNCH_SCRIPT start
fi
RETVAL=$?
[ $RETVAL = 0 ] && touch "/var/lock/subsys/$prog"
if [ -x /etc/rc.d/init.d/functions ]; then
if [ $RETVAL = 0 ]; then
success $"$prog startup"
else
failure $"$prog startup"
fi
fi
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
if [ -f "/var/lock/subsys/$prog" ]; then
if [ -x /etc/rc.d/init.d/functions ]; then
daemon $LAUNCH_SCRIPT stop
else
$LAUNCH_SCRIPT stop
fi
RETVAL=$?
rm -f "/var/lock/subsys/$prog"
else
RETVAL=1
fi
if [ -x /etc/rc.d/init.d/functions ]; then
if [ $RETVAL = 0 ]; then
success $"$prog shutdown"
else
failure $"$prog shutdown"
fi
fi
echo
return $RETVAL
}
status() {
if [ -f "/var/lock/subsys/$prog" ]; then
echo $"$prog is running..."
return 0
else
echo $"$prog is stopped."
return 3
fi
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status
;;
restart|reload)
stop
# HACK: The servlet container often
# takes a couple extra seconds to actually stop
sleep 10
start
;;
condrestart)
if [ -f "/var/lock/subsys/$prog" ] ; then
stop
start
fi
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status}"
exit 1
esac
exit $RETVAL