Skip to content

Added a new script to restart the services gressfully#17

Merged
arghyabi merged 1 commit into
masterfrom
add_restart_script
Sep 6, 2025
Merged

Added a new script to restart the services gressfully#17
arghyabi merged 1 commit into
masterfrom
add_restart_script

Conversation

@arghyabi
Copy link
Copy Markdown
Owner

@arghyabi arghyabi commented Sep 6, 2025

No description provided.

@arghyabi arghyabi requested a review from Copilot September 6, 2025 15:02

This comment was marked as outdated.

@arghyabi arghyabi requested a review from Copilot September 6, 2025 15:05

This comment was marked as outdated.

Signed-off-by: Arghya Biswas <arghyabiswas05@gmail.com>
@arghyabi arghyabi requested a review from Copilot September 6, 2025 15:08
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new Bash script to gracefully restart systemd services and updates the application version. The script provides status checking before and after service restarts with proper error handling.

  • Added restartServices.sh script to restart PHP and Python services with status verification
  • Updated application version from 1.8.0.1015 to 1.8.1.1016 in config.yaml

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
restartServices.sh New Bash script that restarts spring-loaded-switch services with status checks and error handling
config.yaml Version bump to 1.8.1.1016

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread restartServices.sh
Comment on lines +12 to +18
echo "Restarting services..."
for SERVICE in "${SERVICES[@]}"; do
if ! sudo systemctl restart "$SERVICE"; then
echo "ERROR: Failed to restart $SERVICE" >&2
fi
done

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.
Comment thread restartServices.sh
@@ -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.
@arghyabi arghyabi merged commit bd9a5ba into master Sep 6, 2025
1 check passed
@arghyabi arghyabi deleted the add_restart_script branch September 6, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants