finetuning

This commit is contained in:
no
2024-11-28 13:57:54 +01:00
parent fca6e5ba93
commit cf0a34c045
4 changed files with 10 additions and 3 deletions
+6 -1
View File
@@ -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