/etc/init.d/shellinabox is in shellinabox 2.14-1.
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 | #!/bin/sh
### BEGIN INIT INFO
# Provides: shellinabox
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Shell In A Box Daemon
# Description: Daemon for publishing a login shell at
# http://localhost:SHELLINABOX_PORT
# where default port number is 4200.
### END INIT INFO
# Authors: Markus Gutschke <markus@shellinabox.com>, Marc Singer <elf@buici.com>
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DESC="Shell In A Box Daemon"
NAME="shellinabox"
DAEMON="/usr/bin/shellinaboxd"
PIDFILE="/var/run/shellinaboxd.pid"
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x $DAEMON ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
# Set some default values
SHELLINABOX_DATADIR="${SHELLINABOX_DATADIR:-/var/lib/shellinabox}"
SHELLINABOX_PORT="${SHELLINABOX_PORT:-4200}"
SHELLINABOX_USER="${SHELLINABOX_USER:-shellinabox}"
SHELLINABOX_GROUP="${SHELLINABOX_GROUP:-shellinabox}"
#
# Function that starts the daemon/service.
#
d_start() {
if [ -z "$SHELLINABOX_DAEMON_START" -o \
"$SHELLINABOX_DAEMON_START" = "0" ]; then
return 0
fi
eval start-stop-daemon --start --oknodo --pidfile "'$PIDFILE'" \
--exec "'$DAEMON'" -- -q --background="'$PIDFILE'" \
-c "'${SHELLINABOX_DATADIR}'" -p "'${SHELLINABOX_PORT}'" \
-u "'${SHELLINABOX_USER}'" -g "'${SHELLINABOX_GROUP}'" \
$(for i in $(ls /etc/shellinabox/options-enabled/*.css |
sed -e \
's/.*[/]\([0-9]*\)[-_+][^/:,;]*[.]css/\1/'|
sort -u); do
for j in /etc/shellinabox/options-enabled/"$i"*.css; do
echo -n "$j" |
sed -e 's/\(.*[/]\)\([0-9]*\)\([-_+]\)\([^/:,;]*\)[.]css/\4:\3\1\2\3\4.css,/
s/:_/:-/'
done |
sed -e 's/,$/;/'
done |
sed -e 's/;$//
//b
s/.*/--user-css "\0"/') \
"${SHELLINABOX_ARGS}"
}
#
# Function that stops the daemon/service.
#
d_stop() {
start-stop-daemon --stop --oknodo --pidfile "$PIDFILE"
rm -f "$PIDFILE"
}
#
# Function that reloads the config file for the daemon/service.
#
d_reload() {
# Only reload if there are no active sessions running
[ -r "$PIDFILE" ] &&
[ `ps o pid= --ppid "\`cat "$PIDFILE"\`\`ps o pid= --ppid \
\\\`cat "$PIDFILE"\\\`|
xargs -r -n 1 printf ',%s'\`" |
wc -l` -gt 1 ] &&
return 1
d_stop
d_start
}
#
# Function that check the status of the daemon/service.
#
d_status() {
[ -r "$PIDFILE" ] && kill -0 `cat "$PIDFILE"` &&
echo "$DESC is running" || echo "$DESC is not running"
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
d_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
d_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
reload)
[ "$VERBOSE" != no ] && log_daemon_msg "Reloading services for $DESC" "$NAME"
d_reload
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
restart|force-reload)
[ "$VERBOSE" != no ] && log_daemon_msg "Restarting $DESC" "$NAME"
d_stop
d_start
case "$?" in
0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
1) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
*) [ "$VERBOSE" != no ] && log_end_msg 1 ;; # Failed to start
esac
;;
status)
d_status
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|reload}" >&2
exit 1
;;
esac
exit 0
|