File schooltool.init of Package schooltool
#!/bin/bash
#
# schooltool: Starts the schooltool calendar server
#
# chkconfig: - 80 14
# description: schooltool calendar server
# processname: /usr/bin/schooltool
# config: /etc/schooltool/schooltool.conf
#
# /etc/init.d/schooltool
# and its symbolic link
# /usr/sbin/rcschooltool
#
### BEGIN INIT INFO
# Provides: schooltool
# Required-Start: $syslog $remote_fs apache2
# Should-Start: $time smtp
# Required-Stop: $syslog $remote_fs apache2
# Should-Stop: $time smtp
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: SchoolTool daemon providing student information system
# Description: SchoolTool is free administrative software for schools
# around the world.
### END INIT INFO#
# Source function library.
test -f /etc/init.d/functions && . /etc/init.d/functions
test -f /etc/rc.status && . /etc/rc.status
package=schooltool
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/$package
NAME=$package
DESC="SchoolBell"
PNAME=$package # truncated to 15 chars by the kernel
PIDFILE=/var/run/$package/$package.pid
SCRIPTNAME=/etc/init.d/$package
CONFIGFILE=/etc/$package/$package
DEFAULTFILE=/etc/sysconfig/$package
test -x $DAEMON || { echo "$DAEMON not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
test -r $CONFIG || { echo "$CONFIG not existing";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
if [ -r $DEFAULTFILE ]; then
. $DEFAULTFILE
fi
start() {
echo -n "Starting $DESC: $NAME"
# reset permissions, just in case they ran "schooltool"
# by hand as root :-(
chown -R schooltool /var/lib/schooltool
chown -R schooltool /var/run/schooltool
chown -R schooltool /var/log/schooltool
su -s /bin/bash schooltool -c "$DAEMON -d --config=$CONFIGFILE"
echo
}
stop() {
echo -n "Stopping $DESC: $NAME"
killproc $DAEMON
echo "."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload)
echo -n "Restarting $DESC: $NAME"
stop
start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0