Verschiebe in Root

This commit is contained in:
no
2024-11-28 13:36:01 +01:00
parent a99479e4c6
commit fca6e5ba93
8 changed files with 0 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
function restart_service() {
log_info "Attempting to restart service $SERVICE_NAME on $SSH_HOST."
ssh -i $SSH_KEY $SSH_USER@$SSH_HOST "sudo systemctl restart $SERVICE_NAME"
if [ $? -ne 0 ]; then
log_error "Failed to restart service $SERVICE_NAME on $SSH_HOST."
exit 2
fi
ssh -i $SSH_KEY $SSH_USER@$SSH_HOST "sudo ipsec statusall | grep -i 'running'"
if [ $? -ne 0 ]; then
log_critical "Service $SERVICE_NAME not running after restart."
exit 2
fi
log_info "Service $SERVICE_NAME successfully restarted and verified."
}