2
# /etc/init.d/kdm: start or stop the X display manager
3
# Script originally stolen from the xdm package
5
# description: K Desktop Manager
9
# To start kdm even if it is not the default display manager, change
10
# HEED_DEFAULT_DISPLAY_MANAGER to "false."
11
HEED_DEFAULT_DISPLAY_MANAGER=true
12
DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
14
PATH=/bin:/usr/bin:/sbin:/usr/sbin
16
PIDFILE=/var/run/kdm.pid
17
UPGRADEFILE=/var/run/kdm.upgrade
19
test -x $DAEMON || exit 0
21
# uncomment, if you want auto-logon to be runlevel-dependant
22
#test "$runlevel" || { runlevel=`runlevel`; runlevel=${runlevel#* }; }
23
#test "$runlevel" = 4 && ARG=-autolog || ARG=-noautolog
25
# uncomment, if you want tons of debug info in your syslog
26
#ARG="$ARG -debug 255"
28
# If we upgraded the daemon, we can't use the --exec argument to
29
# start-stop-daemon since the inode will have changed. The risk here is that
30
# in a situation where the daemon died, its pidfile was not cleaned up, and
31
# some other process is now running under that pid, start-stop-daemon will send
32
# signals to an innocent process. However, this seems like a corner case.
34
if [ -e $UPGRADEFILE ]; then
35
SSD_ARGS="--pidfile $PIDFILE --startas $DAEMON"
37
SSD_ARGS="--pidfile $PIDFILE --exec $DAEMON"
41
if expr "$(cat /proc/$DAEMONPID/cmdline 2> /dev/null)" : "$DAEMON" > /dev/null 2>&1; then
44
# if the daemon does not remove its own pidfile, we will
45
rm -f $PIDFILE $UPGRADEFILE
52
if [ -e $DEFAULT_DISPLAY_MANAGER_FILE ] &&
53
[ "$HEED_DEFAULT_DISPLAY_MANAGER" = "true" ] &&
54
[ "$(cat $DEFAULT_DISPLAY_MANAGER_FILE)" != "$DAEMON" ]; then
55
echo "Not starting K Desktop Manager (kdm); it is not the default display manager."
57
echo -n "Starting K Desktop Manager: kdm"
58
start-stop-daemon --start --quiet $SSD_ARGS -- $ARG || echo -n " already running"
65
if [ -f $PIDFILE ]; then
74
echo -n "Reloading K Desktop Manager configuration..."
75
if start-stop-daemon --stop --signal 1 --quiet $SSD_ARGS; then
78
echo "kdm not running."
83
/etc/init.d/kdm reload
87
echo -n "Stopping K Desktop Manager: kdm"
88
if [ ! -f $PIDFILE ]; then
89
echo " not running ($PIDFILE not found)."
92
DAEMONPID=$(cat $PIDFILE | tr -d '[:blank:]')
94
if [ ! -e $UPGRADEFILE ]; then
95
if start-stop-daemon --stop --quiet $SSD_ARGS; then
96
# give kdm's signal handler a second to catch its breath
99
echo -n " not running"
102
while [ $KILLCOUNT -le 5 ]; do
103
if stillrunning; then
109
KILLCOUNT=$(( $KILLCOUNT + 1 ))
111
if stillrunning; then
112
echo -n " not responding to TERM signal (pid $DAEMONPID)"
121
echo "Usage: /etc/init.d/kdm {start|stop|restart|reload|force-reload}"