3 # Provides: shellinabox
4 # Required-Start: $network $remote_fs
5 # Required-Stop: $network $remote_fs
6 # Default-Start: 2 3 4 5
8 # Short-Description: Shell In A Box Daemon
9 # Description: Daemon for publishing a login shell at
10 # http://localhost:4200
13 PATH=/sbin:/bin:/usr/sbin:/usr/bin
14 DESC="Shell In A Box Daemon"
16 DAEMON="/usr/bin/shellinaboxd"
17 PIDFILE="/var/run/shellinaboxd.pid"
18 SCRIPTNAME=/etc/init.d/$NAME
20 # Gracefully exit if the package has been removed.
21 test -x $DAEMON || exit 0
23 . /lib/lsb/init-functions
25 # Include shellinabox defaults if available.
26 test -f /etc/default/shellinabox && . /etc/default/shellinabox
28 # Set some default values
29 SHELLINABOX_DATADIR="${SHELLINABOX_DATADIR:-/var/lib/shellinabox}"
30 SHELLINABOX_PORT="${SHELLINABOX_PORT:-4200}"
31 SHELLINABOX_USER="${SHELLINABOX_USER:-shellinabox}"
32 SHELLINABOX_GROUP="${SHELLINABOX_GROUP:-shellinabox}"
35 # Function that starts the daemon/service.
38 if [ -z "$SHELLINABOX_DAEMON_START" -o \
39 "$SHELLINABOX_DAEMON_START" = "0" ]; then
43 eval start-stop-daemon --start --oknodo --pidfile "'$PIDFILE'" \
44 --exec "'$DAEMON'" -- -q --background="'$PIDFILE'" \
45 -c "'${SHELLINABOX_DATADIR}'" -p "'${SHELLINABOX_PORT}'" \
46 -u "'${SHELLINABOX_USER}'" -g "'${SHELLINABOX_GROUP}'" \
47 $(for i in $(ls /etc/shellinabox/options-enabled/*.css |
49 's/.*[/]\([0-9]*\)[-_+][^/:,;]*[.]css/\1/'|
51 for j in /etc/shellinabox/options-enabled/"$i"*.css; do
53 sed -e 's/\(.*[/]\)\([0-9]*\)\([-_+]\)\([^/:,;]*\)[.]css/\4:\3\1\2\3\4.css,/
60 s/.*/--user-css "\0"/') \
65 # Function that stops the daemon/service.
68 start-stop-daemon --stop --oknodo --pidfile "$PIDFILE"
73 # Function that reloads the config file for the daemon/service.
76 # Only reload if there are no active sessions running
78 [ `ps o pid= --ppid "\`cat "$PIDFILE"\`\`ps o pid= --ppid \
79 \\\`cat "$PIDFILE"\\\`|
80 xargs -r -n 1 printf ',%s'\`" |
89 # Function that check the status of the daemon/service.
92 [ -r "$PIDFILE" ] && kill -0 `cat "$PIDFILE"` &&
93 echo "$DESC is running" || echo "$DESC is not running"
98 log_daemon_msg "Starting $DESC" "$NAME"
103 log_daemon_msg "Stopping $DESC" "$NAME"
108 log_daemon_msg "Reloading services for $DESC" "$NAME"
112 restart|force-reload)
113 log_daemon_msg "Restarting $DESC" "$NAME"
122 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|reload}" >&2