From 9a6be3b5d3b2a877c1ee8c9e97276e0cf1007cd0 Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Sun, 4 Nov 2018 14:37:52 +0000 Subject: Initial revision --- shellinabox/build/rc.shellinabox | 74 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 shellinabox/build/rc.shellinabox (limited to 'shellinabox') diff --git a/shellinabox/build/rc.shellinabox b/shellinabox/build/rc.shellinabox new file mode 100644 index 00000000..f3554794 --- /dev/null +++ b/shellinabox/build/rc.shellinabox @@ -0,0 +1,74 @@ +#!/bin/bash +# +# shellinabox This shell script takes care of starting and stopping +# shellinabox. +# +# description: Publish command line shell through AJAX interface. +# processname: shellinaboxd +# config: /etc/sysconfig/shellinabox +# pidfile: /var/run/shellinaboxd.pid + +# Source shellinabox configureation. +if [ -f /etc/sysconfig/shellinabox ] ; then + . /etc/sysconfig/shellinabox +fi + +RETVAL=0 +prog="shellinaboxd" +SHELLINABOXD="/usr/sbin/$prog" +LOCKFILE="/var/lock/subsys/shellinaboxd" +PIDFILE="/var/run/shellinaboxd.pid" + +[ -f $SHELLINABOXD ] || exit 0 + +start() { + echo -n $"Starting $prog: " + $SHELLINABOXD --background=$PIDFILE $DAEMON_OPTIONS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch $LOCKFILE + return $RETVAL +} + +stop() { + # Stop daemons. + echo -n $"Shutting down $prog: " + killall -TERM $prog + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f $LOCKFILE + return $RETVAL +} + +status() { + PIDS=$(pidof $prog) + if [ "$PIDS" == "" ]; then + echo "$prog is not running!" + else + echo "$prog is running at pid(s) ${PIDS}." + fi +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + RETVAL=$? + ;; + status) + status + RETVAL=$? + ;; + *) + echo $"Usage: $0 {start|stop|restart|status}" + exit 1 +esac + +exit $RETVAL -- cgit v1.2.3