reconf the master and common scripts and all unraid essential scripts# Please enter the commit message for your changes. Lines starting
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
#-----------------------------------------------------------------------------------------------
|
||||
# Stop all running User Scripts spawned by the User Scripts plugin
|
||||
#-----------------------------------------------------------------------------------------------
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/../common.sh"
|
||||
|
||||
# Load central config
|
||||
load_master_conf
|
||||
|
||||
# Parse CLI args (supports --dry-run)
|
||||
parse_args "$@"
|
||||
|
||||
# Functions
|
||||
|
||||
stop_user_scripts() {
|
||||
# Get PIDs of running user scripts
|
||||
local pids
|
||||
pids=$(/usr/bin/ps -eo pid,cmd | grep "/tmp/user.scripts" | grep -v grep | awk '{print $1}')
|
||||
|
||||
if [ -z "$pids" ]; then
|
||||
echo "No running user scripts found."
|
||||
return
|
||||
fi
|
||||
|
||||
for pid in $pids; do
|
||||
if [ "$DRY_RUN" = true ]; then
|
||||
echo "[DRY-RUN] Would kill user script with PID $pid"
|
||||
else
|
||||
echo "Killing user script with PID $pid"
|
||||
kill "$pid"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "All user scripts stopped."
|
||||
}
|
||||
|
||||
# MAIN
|
||||
echo "==== User Scripts Stop Script Started: $(date) ===="
|
||||
|
||||
stop_user_scripts
|
||||
Reference in New Issue
Block a user