prerm hotfix
This commit is contained in:
@@ -3,29 +3,40 @@
|
|||||||
echo "Stopping QuecManager Services and removing from rc.local..."
|
echo "Stopping QuecManager Services and removing from rc.local..."
|
||||||
|
|
||||||
# Remove services from rc.local if present
|
# Remove services from rc.local if present
|
||||||
sed -i '/\/www\/cgi-bin\/home\/log_signal_metrics\.sh &/d' /etc/rc.local
|
if sed -i '/\/www\/cgi-bin\/home\/log_signal_metrics\.sh &/d' /etc/rc.local; then
|
||||||
sed -i '/\/www\/cgi-bin\/settings\/change_sms_code\.sh &/d' /etc/rc.local
|
echo "Removed log_signal_metrics.sh entry from rc.local."
|
||||||
|
else
|
||||||
|
echo "Warning: Failed to remove log_signal_metrics.sh entry or it was not found."
|
||||||
|
fi
|
||||||
|
|
||||||
# Define an array of scripts to check and stop
|
if sed -i '/\/www\/cgi-bin\/settings\/change_sms_code\.sh &/d' /etc/rc.local; then
|
||||||
SCRIPTS=(
|
echo "Removed change_sms_code.sh entry from rc.local."
|
||||||
"/www/cgi-bin/home/log_signal_metrics.sh"
|
else
|
||||||
"/www/cgi-bin/settings/change_sms_code.sh"
|
echo "Warning: Failed to remove change_sms_code.sh entry or it was not found."
|
||||||
)
|
fi
|
||||||
|
|
||||||
|
# Define a list of scripts to check and stop
|
||||||
|
SCRIPTS="
|
||||||
|
/www/cgi-bin/home/log_signal_metrics.sh
|
||||||
|
/www/cgi-bin/settings/change_sms_code.sh
|
||||||
|
"
|
||||||
|
|
||||||
# Loop through each script, check if it's running, and kill it if necessary
|
# Loop through each script, check if it's running, and kill it if necessary
|
||||||
for SCRIPT in "${SCRIPTS[@]}"; do
|
echo "Checking and stopping running scripts..."
|
||||||
|
for SCRIPT in $SCRIPTS; do
|
||||||
PID=$(pgrep -f "$SCRIPT")
|
PID=$(pgrep -f "$SCRIPT")
|
||||||
if [ -n "$PID" ]; then
|
if [ -n "$PID" ]; then
|
||||||
echo "Stopping $SCRIPT (PID: $PID)..."
|
echo "Stopping $SCRIPT (PID: $PID)..."
|
||||||
if kill -TERM "$PID"; then
|
if kill -TERM "$PID"; then
|
||||||
echo "Successfully stopped $SCRIPT."
|
echo "Successfully stopped $SCRIPT."
|
||||||
else
|
else
|
||||||
echo "Failed to stop $SCRIPT."
|
echo "Error: Failed to stop $SCRIPT."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "$SCRIPT is not running. Nothing to stop."
|
echo "$SCRIPT is not running. Nothing to stop."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo "Cleanup complete."
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user