Skip to content

Instantly share code, notes, and snippets.

@100daysofdevops
Created March 25, 2019 16:07
Show Gist options
  • Select an option

  • Save 100daysofdevops/0bf265a32b1d8b165eabba00f0419559 to your computer and use it in GitHub Desktop.

Select an option

Save 100daysofdevops/0bf265a32b1d8b165eabba00f0419559 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
systemctl start $servicename
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment