#
# kdm: Starts the KDE Display Manager
#
-# Version: @(#) /etc/rc.d/init.d/kdm 0.1
-#
-# description: Starts and stops the KDE Display Manager at startup and
+# description: Starts and stops the KDE Display Manager at startup and \
# shutdown..
#
-# chkconfig: 5 95 5
+# chkconfig: 5 95 05
#
# probe: true
# hide: true
+#
+# $Id$
. /etc/rc.d/init.d/functions
# Get service config
-if [ -f /etc/sysconfig/kdm ] ; then
+if [ -f /etc/sysconfig/kdm ]; then
. /etc/sysconfig/kdm
fi
-# See how we were called.
-case "$1" in
- start)
+start() {
# Check if the service is already running?
if [ ! -f /var/lock/subsys/kdm ]; then
msg_starting "KDE Display Manager"
- daemon kdm
- touch /var/lock/subsys/kdm
+ daemon /usr/bin/kdm
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch /var/lock/subsys/kdm
else
msg_already_running "KDE Display Manager"
- exit 1
fi
- ;;
- stop)
+}
+
+stop() {
# Check if the service is already running?
if [ -f /var/lock/subsys/kdm ]; then
msg_stopping "KDE Display Manager"
killproc kdm
rm -f /var/lock/subsys/kdm
else
- msg_already_running "KDE Display Manager"
- exit 1
+ msg_not_running "KDE Display Manager"
fi
+}
+
+condrestart() {
+ if [ -f /var/lock/subsys/kdm ]; then
+ stop
+ start
+ else
+ msg_not_running "KDE Display Manager"
+ RETVAL=$1
+ fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ try-restart)
+ condrestart 0
+ ;;
+ force-reload)
+ condrestart 7
;;
status)
status kdm
- ;;
- restart|reload)
- $0 stop
- $0 start
+ exit $?
;;
*)
- msg_usage "$0 {start|stop|restart|reload|status}"
- exit 1
+ msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+ exit 3
esac
-exit 0
+exit $RETVAL