finetuning
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
function restart_service() {
|
||||
if [[ "$AUTO_RESTART_SERVICE" != "true" ]]; then
|
||||
log_info "Automatic service restart is disabled. Skipping restart."
|
||||
return 0
|
||||
fi
|
||||
|
||||
log_info "Attempting to restart service $SERVICE_NAME on $SSH_HOST."
|
||||
|
||||
ssh -i $SSH_KEY $SSH_USER@$SSH_HOST "sudo systemctl restart $SERVICE_NAME"
|
||||
@@ -9,7 +14,7 @@ function restart_service() {
|
||||
exit 2
|
||||
fi
|
||||
|
||||
ssh -i $SSH_KEY $SSH_USER@$SSH_HOST "sudo ipsec statusall | grep -i 'running'"
|
||||
ssh -i $SSH_KEY $SSH_USER@$SSH_HOST "sudo ipsec statusall | grep -i '1 up, 0 connecting'"
|
||||
if [ $? -ne 0 ]; then
|
||||
log_critical "Service $SERVICE_NAME not running after restart."
|
||||
exit 2
|
||||
|
||||
Reference in New Issue
Block a user