soapdish/scripts/system/system-killall_and_restart

45 lines
944 B
Bash
Executable File

#!/bin/bash
# SYSTEM: KILL STREAM PROCESSES
# Kill all processes with name of liquidsoap
# Includes and Declarations (global variables, formatting, and functions)
source "${APPLICATION_ROOT}/scripts/system/system-functions"
source "${APPLICATION_ROOT}/scripts/system/system-declarations"
# Kill Show
sudo pkill "liquidsoap";
# Wait and restart liquidsoap
sleep 2
# Attempt to restart liquidsoap as a service (if possible)
if RESULT=$(sudo systemctl restart liquidsoap 2>&1)
then
STDOUT="$RESULT"
confirmation_message "[K] Killall and Restart liquidsoap: executed";
echo "";
else
# Error code (not used)
RC=$?
# echo "code $RC"
# Error message (not used)
STDERR=$RESULT
# echo "THIS: $STDERR ok?"
echo "Liquidsoap killed, not restarted as a service (liquidsoap not a service)."
confirmation_message "[K] Killall and Restart liquidsoap: Liquidsoap killed.";
echo "";
fi
# Echo result