3 # Largely adapted from xdm's init script:
4 # Copyright 1998-2002, 2004, 2005 Branden Robinson <branden@debian.org>.
5 # Copyright 2006 Eugene Konev <ejka@imfi.kspu.ru>
7 # This is free software; you may redistribute it and/or modify
8 # it under the terms of the GNU General Public License as
9 # published by the Free Software Foundation; either version 2,
10 # or (at your option) any later version.
12 # This is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License with
18 # the Debian operating system, in /usr/share/common-licenses/GPL; if
19 # not, write to the Free Software Foundation, Inc., 51 Franklin Street,
20 # Fifth Floor, Boston, MA 02110-1301, USA.
24 # Required-Start: $local_fs $remote_fs dbus
25 # Required-Stop: $local_fs $remote_fs dbus
26 # Should-Start: $named
28 # Default-Start: 2 3 4 5
30 # Short-Description: Start lightdm
35 HEED_DEFAULT_DISPLAY_MANAGER=
36 # To start lightdm even if it is not the default display manager, change
37 # HEED_DEFAULT_DISPLAY_MANAGER to "false."
38 # Also overridable from command line like:
39 # HEED_DEFAULT_DISPLAY_MANAGER=false /etc/init.d/lightdm start
40 [ -z "$HEED_DEFAULT_DISPLAY_MANAGER" ] && HEED_DEFAULT_DISPLAY_MANAGER=true
42 DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
44 PATH=/bin:/usr/bin:/sbin:/usr/sbin
45 DAEMON=/usr/sbin/lightdm
46 PIDFILE=/var/run/lightdm.pid
48 if [ -r /etc/default/locale ]; then
53 test -x $DAEMON || exit 0
55 . /lib/lsb/init-functions
57 SSD_START_ARGS="--pidfile $PIDFILE --name $(basename $DAEMON) --startas $DAEMON -- -d"
58 SSD_STOP_ARGS="--pidfile $PIDFILE --name $(basename $DAEMON) --retry TERM/5/TERM/5"
62 if [ "$HEED_DEFAULT_DISPLAY_MANAGER" = "true" ] &&
63 [ -e $DEFAULT_DISPLAY_MANAGER_FILE ] &&
64 [ "$(cat $DEFAULT_DISPLAY_MANAGER_FILE)" != "/usr/bin/lightdm" -a "$(cat $DEFAULT_DISPLAY_MANAGER_FILE)" != "/usr/sbin/lightdm" ]; then
65 echo "Not starting X display manager (lightdm); it is not the default" \
68 log_daemon_msg "Starting X display manager" "lightdm"
69 start-stop-daemon --start --quiet $SSD_START_ARGS \
70 || log_progress_msg "already running"
76 [ -f $PIDFILE ] && /etc/init.d/lightdm stop
77 [ -f $PIDFILE ] && exit 1
78 /etc/init.d/lightdm start
82 log_daemon_msg "Stopping X display manager" "lightdm"
83 if ! [ -f $PIDFILE ]; then
84 log_progress_msg "not running ($PIDFILE not found)"
86 start-stop-daemon --stop --quiet $SSD_STOP_ARGS
88 if [ $SSD_RES -eq 1 ]; then
89 log_progress_msg "not running"
91 if [ $SSD_RES -eq 2 ]; then
92 log_progress_msg "not responding to TERM signals"
94 if [ -f $PIDFILE ]; then
95 log_progress_msg "(removing stale $PIDFILE)"
103 /etc/init.d/lightdm restart
107 echo "Usage: /etc/init.d/lightdm {start|stop|restart|force-reload}"