File: init

package info (click to toggle)
wdm 1.0-7
  • links: PTS
  • area: main
  • in suites: slink
  • size: 1,368 kB
  • ctags: 527
  • sloc: ansic: 1,805; sh: 647; makefile: 454; perl: 31
file content (84 lines) | stat: -rw-r--r-- 1,833 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/sh
# /etc/init.d/wdm: start or stop the X display manager

set -e

PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/bin/X11/wdm
PIDFILE=/var/run/wdm.pid

test -x $DAEMON || exit 0

if grep -q ^check-local-xserver /etc/X11/wdm/wdm.options; then
  CHECK_LOCAL_XSERVER=yes
fi

case "$1" in
  start)
    if [ ${CHECK_LOCAL_XSERVER} ]; then
      problem=yes
      echo -n "Checking for valid XFree86 server configuration..."
      if [ -e /etc/X11/XF86Config ]; then
        if [ -x /usr/sbin/parse-xf86config ]; then
          if parse-xf86config --quiet --nowarning --noadvice /etc/X11/XF86Config; then
            problem=
          else
            echo "error in configuration file."
          fi
        else
          echo "unable to check."
        fi
      else
        echo "file not found."
      fi
      if [ $problem ]; then
        echo "Not starting X display manager."
        exit 1
      else
        echo "done."
      fi
    fi
    echo -n "Starting X display manager: wdm"
    start-stop-daemon --start --quiet --exec $DAEMON || echo -n " already running"
    echo "."
  ;;

  restart)
    /etc/init.d/wdm stop
    /etc/init.d/wdm start
  ;;

  reload)
    echo -n "Reloading X display manager configuration..."
    if start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE; then
      echo "done."
    else
      echo "wdm not running."
    fi
  ;;

  force-reload)
    /etc/init.d/wdm reload
  ;;

  stop)
    echo -n "Stopping X display manager: wdm"
    if [ "$(pidof $DAEMON)" ] ; then
      killall -q $DAEMON || true
      sleep 1
      if [ "$(pidof $DAEMON)" ] ; then
        killall -q -KILL $DAEMON || true
      fi
    else
      echo -n " not running"
    fi
    echo "."
  ;;

  *)
    echo "Usage: /etc/init.d/wdm {start|stop|restart|reload|force-reload}"
    exit 1
    ;;
esac

exit 0