Files
openipc-builder/devices/ssc30kq_apfpv_greg-generic-bu-eu/general/overlay/etc/init.d/S95majestic
T

63 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
. /etc/init.d/libmedia.sh
DAEMON="/usr/bin/majestic"
NAME="majestic"
PIDFILE="/var/run/majestic.pid"
start() {
echo "Starting $NAME..."
if ensure_pidfile "$NAME" "$PIDFILE"; then
echo "$NAME is already running"
return 0
fi
rm -f "$PIDFILE"
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "$DAEMON" -- -s
if [ $? -ne 0 ]; then
echo "Failed to launch $NAME"
return 1
fi
echo "$NAME launch requested"
}
stop() {
echo "Stopping $NAME..."
stop_service "$NAME" "$PIDFILE" 15 || return 1
# Majestic keeps internal single-instance state briefly after exit.
sleep 2
}
status() {
if ensure_pidfile "$NAME" "$PIDFILE"; then
echo "$NAME running pid=$(cat "$PIDFILE")"
return 0
fi
echo "$NAME stopped"
return 1
}
reload() {
ensure_pidfile "$NAME" "$PIDFILE" || {
echo "$NAME not running"
return 1
}
kill -HUP "$(cat "$PIDFILE")"
}
restart() {
stop
start
}
case "$1" in
start|stop|restart|reload|status)
"$1"
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 1
;;
esac