Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions general/package/majestic/files/S95majestic
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,28 @@ start() {
fi
}

# Stop by pidfile, then verify the daemon is actually gone. majestic's own
# watchdog restarts it with a new pid that start-stop-daemon knows nothing
# about, so the pidfile goes stale; -K on a stale pidfile kills nothing, and
# "restart" then starts a SECOND majestic next to the running one - both
# fighting over the encoder, with config edits silently never loaded. killall
# matches by name, which is the one identity that cannot go stale.
stop() {
echo -n "Stopping $DAEMON: "
start-stop-daemon -K -q -p "$PIDFILE"
if [ $? -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
sleep 1
if pidof "$DAEMON" > /dev/null 2>&1; then
killall "$DAEMON" 2> /dev/null
sleep 2
killall -9 "$DAEMON" 2> /dev/null
sleep 1
fi
if pidof "$DAEMON" > /dev/null 2>&1; then
echo "FAIL"
return 1
fi
rm -f "$PIDFILE"
echo "OK"
Comment thread
qodo-free-for-open-source-projects[bot] marked this conversation as resolved.
}

case "$1" in
Expand All @@ -31,7 +44,7 @@ case "$1" in
;;

restart)
stop
stop || exit 1
sleep 3
start
;;
Expand Down