Skip to content

Instantly share code, notes, and snippets.

@cdzombak cdzombak/mis forked from davestephens/mis
Last active Jan 8, 2019

Embed
What would you like to do?
Mystic BBS init.d script
#!/bin/sh
### BEGIN INIT INFO
# Provides: mis
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Should-Start: $all
# Should-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Mystic Internet Server
# Description: mis is the launcher for Mystic's Internet Servers
### END INIT INFO
set -e
. /lib/lsb/init-functions
MYSTICINSTALLPATH=/mystic/bbs
DAEMON=$MYSTICINSTALLPATH/mis
NAME=mis
DESC="Mystic Internet Server"
MIS_OPTS=
PID="$MYSTICINSTALLPATH/semaphore/$NAME.bsy"
# Check if DAEMON binary exists
[ -f $DAEMON ] || exit 0
[ -f "/etc/default/$NAME" ] && . /etc/default/$NAME
MIS_OPTS="daemon"
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
if start-stop-daemon -d $MYSTICINSTALLPATH --start --quiet --pidfile $PID --exec $DAEMON -- $MIS_OPTS 1>/dev/null
then
log_end_msg 0
else
log_end_msg 1
fi
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
if start-stop-daemon --retry TERM/5/KILL/5 --stop --quiet --pidfile $PID 1>/dev/null
then
log_end_msg 0
else
log_end_msg 1
fi
;;
restart)
log_daemon_msg "Restarting $DESC" "$NAME"
start-stop-daemon --retry TERM/5/KILL/5 --stop --quiet --pidfile $PID 1>/dev/null
if start-stop-daemon -d $MYSTICINSTALLPATH --start --quiet --oknodo --pidfile $PID --exec $DAEMON -- $MIS_OPTS 1>/dev/null
then
log_end_msg 0
else
log_end_msg 1
fi
;;
status)
status_of_proc -p $PID $DAEMON $NAME
;;
*)
log_action_msg "Usage: /etc/init.d/$NAME {start|stop|restart|status}"
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.