/etc/init.d/xrdp is in xrdp 0.9.5-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | #!/bin/sh
### BEGIN INIT INFO
# Provides: xrdp
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: xrdp (X Remote Desktop Protocol) full server
# Description: The xrdp daemon uses the Remote Desktop Protocol
# to present a graphical login to a remote client,
# allowing connections to an xorgxrdp or VNC server
# or another RDP server. The xrdp-sesman daemon
# authenticates the users against PAM and starts
# the session and, if necessary, X11 server.
### END INIT INFO
#-
# Copyright © 2015 mirabilos <thorsten.glaser@teckids.org>
# Published under The MirOS Licence.
# absolute basics
LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin
export LC_ALL PATH
unset LANGUAGE
# exit cleanly if disabled or not installed
test -x /usr/sbin/xrdp || exit 0
# Debian/LSB init script foobar
DESC='Remote Desktop Protocol server'
NAME=xrdp
. /lib/init/vars.sh
test -t 0 && VERBOSE=yes
. /lib/lsb/init-functions
# read options
SESMAN_START=yes
SESMAN_OPTIONS=
XRDP_OPTIONS=
test -r /etc/default/xrdp && . /etc/default/xrdp
# prepare for actions
case $1 in
(status)
# nothing to do here
;;
(start|stop|force-reload|restart|try-restart)
# check for root; create run-time directories
. /usr/share/xrdp/socksetup
;;
(*)
# syntax error
echo >&2 "Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
exit 3
;;
esac
# take action
rv=0
case $1 in
(start)
test x"$VERBOSE" = x"no" || log_daemon_msg "Starting $DESC"
test x"$SESMAN_START" = x"yes" && \
if start-stop-daemon --start --quiet \
--pidfile /var/run/xrdp/xrdp-sesman.pid \
--startas /usr/sbin/xrdp-sesman --name xrdp-sesman \
--exec /usr/sbin/xrdp-sesman --test; then
test x"$VERBOSE" = x"no" || log_progress_msg "xrdp-sesman"
start-stop-daemon --start --quiet \
--pidfile /var/run/xrdp/xrdp-sesman.pid \
--startas /usr/sbin/xrdp-sesman --name xrdp-sesman \
--exec /usr/sbin/xrdp-sesman -- $SESMAN_OPTIONS
rc=$?
test $rc -gt 0 && rv=$rc
else
test x"$VERBOSE" = x"no" || \
log_progress_msg "sesman already running"
fi
if start-stop-daemon --start --quiet \
--pidfile /var/run/xrdp/xrdp.pid \
--chuid xrdp:xrdp \
--startas /usr/sbin/xrdp --name xrdp \
--exec /usr/sbin/xrdp --test; then
test x"$VERBOSE" = x"no" || log_progress_msg "xrdp"
start-stop-daemon --start --quiet \
--pidfile /var/run/xrdp/xrdp.pid \
--chuid xrdp:xrdp \
--startas /usr/sbin/xrdp --name xrdp \
--exec /usr/sbin/xrdp -- $XRDP_OPTIONS
rc=$?
test $rc -gt 0 && rv=$rc
else
test x"$VERBOSE" = x"no" || \
log_progress_msg "xrdp already running"
fi
test x"$VERBOSE" = x"no" || log_end_msg $rv
;;
(stop)
test x"$VERBOSE" = x"no" || log_daemon_msg "Stopping $DESC"
test x"$VERBOSE" = x"no" || log_progress_msg "xrdp"
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
--pidfile /var/run/xrdp/xrdp.pid \
--name xrdp --exec /usr/sbin/xrdp
rc=$?
if test $rc -gt 1; then
rv=$rc
else
start-stop-daemon --stop --quiet --oknodo \
--retry=0/30/KILL/5 --exec /usr/sbin/xrdp
rc=$?
test $rc -gt 1 && test $rv -lt $rc && rv=$rc
fi
test x"$VERBOSE" = x"no" || log_progress_msg "xrdp-sesman"
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
--pidfile /var/run/xrdp/xrdp-sesman.pid \
--name xrdp-sesman --exec /usr/sbin/xrdp-sesman
rc=$?
if test $rc -gt 1; then
rv=$rc
else
start-stop-daemon --stop --quiet --oknodo \
--retry=0/30/KILL/5 --exec /usr/sbin/xrdp-sesman
rc=$?
test $rc -gt 1 && test $rv -lt $rc && rv=$rc
fi
rm -f /var/run/xrdp/xrdp-sesman.pid /var/run/xrdp/xrdp.pid
rm -rf /var/run/xrdp/sockdir
test x"$VERBOSE" = x"no" || log_end_msg $rv
;;
(status)
if test x"$SESMAN_START" = x"yes"; then
status_of_proc -p /var/run/xrdp/xrdp-sesman.pid \
/usr/sbin/xrdp-sesman xrdp-sesman
rc=$?
test $rc -gt $rv && rv=$rc
fi
status_of_proc -p /var/run/xrdp/xrdp.pid /usr/sbin/xrdp xrdp
rc=$?
test $rc -gt $rv && rv=$rc
exit $rv
;;
(force-reload|restart)
test x"$VERBOSE" = x"no" || log_daemon_msg "Restarting $DESC"
if test x"$SESMAN_START" = x"yes"; then
test x"$VERBOSE" = x"no" || log_progress_msg "xrdp-sesman"
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
--pidfile /var/run/xrdp/xrdp-sesman.pid \
--name xrdp-sesman --exec /usr/sbin/xrdp-sesman
if test $? -lt 2; then
start-stop-daemon --stop --quiet --oknodo \
--retry=0/30/KILL/5 --exec /usr/sbin/xrdp-sesman
fi
rm -f /var/run/xrdp/xrdp-sesman.pid
start-stop-daemon --start --quiet \
--pidfile /var/run/xrdp/xrdp-sesman.pid \
--startas /usr/sbin/xrdp-sesman --name xrdp-sesman \
--exec /usr/sbin/xrdp-sesman -- $SESMAN_OPTIONS
rc=$?
test $rc -gt 0 && rv=$rc
fi
test x"$VERBOSE" = x"no" || log_progress_msg "xrdp"
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
--pidfile /var/run/xrdp/xrdp.pid \
--name xrdp --exec /usr/sbin/xrdp
if test $? -lt 2; then
start-stop-daemon --stop --quiet --oknodo \
--retry=0/30/KILL/5 --exec /usr/sbin/xrdp
fi
rm -f /var/run/xrdp/xrdp.pid
start-stop-daemon --start --quiet \
--pidfile /var/run/xrdp/xrdp.pid \
--chuid xrdp:xrdp \
--startas /usr/sbin/xrdp --name xrdp \
--exec /usr/sbin/xrdp -- $XRDP_OPTIONS
rc=$?
test $rc -gt 0 && rv=$rc
test x"$VERBOSE" = x"no" || log_end_msg $rv
;;
(try-restart)
log_daemon_msg "Trying to restart $DESC"
if ! status_of_proc -p /var/run/xrdp/xrdp.pid \
/usr/sbin/xrdp xrdp >/dev/null 2>&1; then
log_progress_msg "is not running."
log_end_msg 1
exit 0
fi
if status_of_proc -p /var/run/xrdp/xrdp-sesman.pid \
/usr/sbin/xrdp-sesman xrdp-sesman >/dev/null 2>&1; then
test x"$VERBOSE" = x"no" || log_progress_msg "xrdp-sesman"
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
--pidfile /var/run/xrdp/xrdp-sesman.pid \
--name xrdp-sesman --exec /usr/sbin/xrdp-sesman
if test $? -lt 2; then
start-stop-daemon --stop --quiet --oknodo \
--retry=0/30/KILL/5 --exec /usr/sbin/xrdp-sesman
fi
rm -f /var/run/xrdp/xrdp-sesman.pid
start-stop-daemon --start --quiet \
--pidfile /var/run/xrdp/xrdp-sesman.pid \
--startas /usr/sbin/xrdp-sesman --name xrdp-sesman \
--exec /usr/sbin/xrdp-sesman -- $SESMAN_OPTIONS
rc=$?
test $rc -gt 0 && rv=$rc
fi
test x"$VERBOSE" = x"no" || log_progress_msg "xrdp"
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
--pidfile /var/run/xrdp/xrdp.pid \
--name xrdp --exec /usr/sbin/xrdp
if test $? -lt 2; then
start-stop-daemon --stop --quiet --oknodo \
--retry=0/30/KILL/5 --exec /usr/sbin/xrdp
fi
rm -f /var/run/xrdp/xrdp.pid
start-stop-daemon --start --quiet \
--pidfile /var/run/xrdp/xrdp.pid \
--chuid xrdp:xrdp \
--startas /usr/sbin/xrdp --name xrdp \
--exec /usr/sbin/xrdp -- $XRDP_OPTIONS
rc=$?
test $rc -gt 0 && rv=$rc
test x"$VERBOSE" = x"no" || log_end_msg $rv
;;
esac
# make “/etc/init.d/xrdp status” work for nōn-root
(sleep 3; chmod a+r /var/run/xrdp/*.pid 2>/dev/null) &
exit 0
|