Linux – systemd Service Watcher (Bash)
Watch systemd service health.
#!/usr/bin/env bash
SERVICES=("docker" "sshd" "cron")
for s in "${SERVICES[@]}"; do
if ! systemctl is-active --quiet "$s"; then
echo "Restarting $s"; systemctl restart "$s"
fi
done
From Joseph Nakhle's automation workbench.
More Other tools scripts