#!/bin/bash
#
# chkconfig: - 85 15
# description: GNU Krell Monitors Server
#
# processname: gkrellmd
# config: /etc/gkrellmd.conf
### BEGIN INIT INFO
# Provides: gkrellmd
# Required-Start: $network
# Required-Stop: $network
# Should-Start: hddtemp
# Should-Stop: hddtemp
# Short-Description: GNU Krell Monitors Server
# Description: GNU Krell Monitors Server
### END INIT INFO
# source function library
. /etc/rc.d/init.d/functions
exec=/usr/sbin/gkrellmd
prog=${exec##*/}
lockfile=/var/lock/subsys/$prog
start() {
if [ -f /etc/gkrellmd.conf ] ; then
echo -n $"Starting GNU Krell Monitors server ($prog): "
DISPLAY= daemon --user gkrellmd $exec -d
rv=$?
echo
else
action $"Unconfigured: $prog, /etc/gkrellmd.conf not found" /bin/false
rv=6
fi
[ $rv -eq 0 ] && touch $lockfile
return $rv
}
stop() {
echo -n $"Stopping GNU Krell Monitors server ($prog): "
killproc $prog
rv=$?
[ $rv -eq 0 ] && rm -f $lockfile
echo
return $rv
}
restart() {
stop
start
}
case "$1" in
start|stop|restart)
$1
;;
force-reload)
restart
;;
status)
status $prog
;;
try-restart|condrestart)
if status $prog >/dev/null ; then
restart
fi
;;
reload)
action $"Service $prog does not support the reload action: " /bin/false
exit 3
;;
*)
echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
exit 2
esac