diff --git a/mistserver.init b/mistserver.init new file mode 100644 index 00000000..87911c1a --- /dev/null +++ b/mistserver.init @@ -0,0 +1,46 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: mistserver +# Required-Start: $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: MistServer service +# Description: MistServer - next generation multimedia server +### END INIT INFO + +# +# Function that starts the daemon/service +# +do_start() +{ + MistController -d -L /var/log/mistserver.log -c /etc/mistserver.conf +} + +# +# Function that stops the daemon/service +# +do_stop() +{ + killall MistController +} + +case "$1" in + start) + echo "Starting MistServer" + do_start + ;; + stop) + echo "Stopping MistServer" + do_stop + ;; + restart) + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + sleep 2 + do_start + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2 + exit 3 + ;; +esac diff --git a/mistserver.service b/mistserver.service new file mode 100644 index 00000000..b3cc943a --- /dev/null +++ b/mistserver.service @@ -0,0 +1,12 @@ +[Unit] +Description=MistServer +After=networkmanager.service + +[Service] +Type=simple +ExecStart=/usr/bin/MistController -c /etc/mistserver.conf +Restart=always +RestartSec=5 + +[Install] +WantedBy=multi-user.target