first commit
This commit is contained in:
@@ -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."
|
||||
}
|
||||
Reference in New Issue
Block a user