-
Notifications
You must be signed in to change notification settings - Fork 21
/
nodm.init-script
83 lines (69 loc) · 2.05 KB
/
nodm.init-script
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
#!/bin/sh
### BEGIN INIT INFO
# Provides: nodm
# Should-Start: bluetooth
# Required-Start: $remote_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Description: Display Manager for automatic session logins
# Short-Description: No Display Manager
### END INIT INFO
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DESC="Automatic Display Manager"
NAME=nodm
PIDDIR=/var/run/
PIDFILE=${PIDDIR}/${NAME}.pid
NODM_ENABLED=no
NODM_XINIT=/usr/bin/xinit
NODM_FIRST_VT=7
NODM_XSESSION=/etc/X11/Xsession
NODM_OPTIONS=
NODM_X_OPTIONS="-nolisten tcp"
NODM_USER=root
NODM_MIN_SESSION_TIME=60
NODM_X_TIMEOUT=300
if [ -f /etc/default/$NAME ]
then
. /etc/default/$NAME
fi
export NODM_XINIT NODM_XSESSION NODM_X_OPTIONS NODM_USER NODM_MIN_SESSION_TIME NODM_FIRST_VT NODM_X_TIMEOUT
# If you change the user to a non-root user, make sure you
# set allowed_users=anybody in /etc/X11/Xwrapper.config
# Gracefully exit if the package or its dependencies have been removed (but not purged).
[ -x /usr/sbin/nodm -a -x "$NODM_XSESSION" -a -x "$NODM_XINIT" ] || exit 0
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
. /lib/lsb/init-functions
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
if [ "$NODM_ENABLED" = "no" ] || [ "$NODM_ENABLED" = "false" ]
then
log_warning_msg "Not starting $NAME because NODM_ENABLED is '$NODM_ENABLED' in /etc/default/$NAME"
else
start-stop-daemon --start --quiet --oknodo --pidfile ${PIDFILE} --make-pidfile --background --exec /usr/sbin/nodm -- ${NODM_OPTIONS}
fi
[ "$VERBOSE" != no ] && log_end_msg $?
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
start-stop-daemon --stop --quiet --retry 10 --pidfile ${PIDFILE} --oknodo
rm -f ${PIDFILE}
[ "$VERBOSE" != no ] && log_end_msg $?
;;
restart|force-reload)
$0 stop
$0 start
;;
status)
status_of_proc -p ${PIDFILE} /usr/sbin/nodm nodm && exit 0 || exit $?
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0