#!/bin/bash SERVICE="fail2ban" if pgrep -f "$SERVICE" >/dev/null then echo "$SERVICE is running" else echo "$SERVICE stopped" >> /var/log/fail2ban_restart.log /etc/init.d/fail2ban start # mail fi
This program is working.