Skip to content

Instantly share code, notes, and snippets.

@100daysofdevops
Created April 16, 2019 15:50
Show Gist options
  • Select an option

  • Save 100daysofdevops/27b07f0e4233944522e5d6bd61f46729 to your computer and use it in GitHub Desktop.

Select an option

Save 100daysofdevops/27b07f0e4233944522e5d6bd61f46729 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
servicename="httpd"
if (( $(ps -ef | grep -v grep | grep $servicename | wc -l) > 0 ))
then
echo "$servicename is running!!!"
else
echo "$servicename is not running" | mail -s "$servicename is down" laprashant@gmail.com
systemctl start $servicename
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment