#!/bin/sh DAEMON=shellinabox DAEMON_BIN=shellinaboxd DAEMON_LONG_NAME="Shell in a Box" . /etc/init.d/modlibrc config() { if [ "$SHELLINABOX_USEBOXCERT" != yes ]; then mkdir -p /tmp/shellinabox if [ -n "${SHELLINABOX_CERT// /}" -a -z "${SHELLINABOX_NOSSL// /}" ]; then echo "$SHELLINABOX_CERT" > /tmp/shellinabox/certificate.pem fi fi } start() { local CMDLINE="-b --pidfile=$PID_FILE" [ -n "${SHELLINABOX_PORT// /}" ] && CMDLINE="$CMDLINE -p $SHELLINABOX_PORT" if [ -n "${SHELLINABOX_NOSSL// /}" ]; then CMDLINE="$CMDLINE -t" else if [ "$SHELLINABOX_USEBOXCERT" == yes ]; then CMDLINE="$CMDLINE --cert-from-box" else CMDLINE="$CMDLINE -c /tmp/shellinabox" fi fi [ -n "${SHELLINABOX_SERVICE// /}" ] && CMDLINE="$CMDLINE -s $SHELLINABOX_SERVICE" modlib_startdaemon $DAEMON_BIN $CMDLINE $SHELLINABOX_OPTIONS } case $1 in ""|load) modlib_add_user_and_group nobody modreg cgi $DAEMON "$DAEMON_LONG_NAME" modreg daemon $DAEMON modlib_start $SHELLINABOX_ENABLED ;; unload) modunreg daemon $DAEMON modunreg cgi $DAEMON modlib_stop ;; start) modlib_start ;; stop) modlib_stop ;; restart) modlib_restart ;; status) modlib_status ;; *) echo "Usage: $0 [load|unload|start|stop|restart|status]" 1>&2 exit 1 ;; esac exit 0