Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
appVersion: 1.8.0.1015
appVersion: 1.8.1.1016
maxCount : 7500000
24 changes: 24 additions & 0 deletions restartServices.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
Copy link

Copilot AI Sep 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script lacks error handling options. Consider adding set -euo pipefail after the shebang to make the script exit on errors, undefined variables, and pipe failures for more robust execution.

Copilot uses AI. Check for mistakes.

SERVICES=("spring-loaded-switch-php.service" "spring-loaded-switch-python.service")

echo "Checking status before restart..."
for SERVICE in "${SERVICES[@]}"; do
echo "Status of $SERVICE:"
sudo systemctl status "$SERVICE" --no-pager
echo "-----------------------------"
done

echo "Restarting services..."
for SERVICE in "${SERVICES[@]}"; do
if ! sudo systemctl restart "$SERVICE"; then
echo "ERROR: Failed to restart $SERVICE" >&2
fi
done

Comment on lines +12 to +18
Copy link

Copilot AI Sep 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script continues restarting other services even when one fails. Consider using exit 1 after the error message to stop execution when a service fails to restart, or add a flag to track failures and exit with non-zero status at the end.

Suggested change
echo "Restarting services..."
for SERVICE in "${SERVICES[@]}"; do
if ! sudo systemctl restart "$SERVICE"; then
echo "ERROR: Failed to restart $SERVICE" >&2
fi
done
echo "Restarting services..."
FAILED=0
for SERVICE in "${SERVICES[@]}"; do
if ! sudo systemctl restart "$SERVICE"; then
echo "ERROR: Failed to restart $SERVICE" >&2
FAILED=1
fi
done
if [ "$FAILED" -ne 0 ]; then
echo "One or more services failed to restart." >&2
exit 1
fi

Copilot uses AI. Check for mistakes.
Comment on lines +12 to +18
Copy link

Copilot AI Sep 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script continues processing remaining services even when a service fails to restart. Consider adding exit 1 after the error message to halt execution on failure, or implement a flag to track failures and exit with an error code at the end.

Suggested change
echo "Restarting services..."
for SERVICE in "${SERVICES[@]}"; do
if ! sudo systemctl restart "$SERVICE"; then
echo "ERROR: Failed to restart $SERVICE" >&2
fi
done
echo "Restarting services..."
FAILED=0
for SERVICE in "${SERVICES[@]}"; do
if ! sudo systemctl restart "$SERVICE"; then
echo "ERROR: Failed to restart $SERVICE" >&2
FAILED=1
fi
done
if [ "$FAILED" -ne 0 ]; then
echo "One or more services failed to restart. Exiting with error." >&2
exit 1
fi

Copilot uses AI. Check for mistakes.
echo "Checking status after restart..."
for SERVICE in "${SERVICES[@]}"; do
echo "Status of $SERVICE:"
sudo systemctl status "$SERVICE" --no-pager
echo "-----------------------------"
done