Added a new script to restart the services gressfully#17
Conversation
38d214c to
e9fd824
Compare
Signed-off-by: Arghya Biswas <arghyabiswas05@gmail.com>
e9fd824 to
0d2869e
Compare
There was a problem hiding this comment.
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.shscript 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.
| echo "Restarting services..." | ||
| for SERVICE in "${SERVICES[@]}"; do | ||
| if ! sudo systemctl restart "$SERVICE"; then | ||
| echo "ERROR: Failed to restart $SERVICE" >&2 | ||
| fi | ||
| done | ||
|
|
There was a problem hiding this comment.
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.
| 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 |
| @@ -0,0 +1,24 @@ | |||
| #!/bin/bash | |||
There was a problem hiding this comment.
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.
No description provided.