Skip to content

Instantly share code, notes, and snippets.

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

  • Save 100daysofdevops/0702642db634d284df755ef04b6d501b to your computer and use it in GitHub Desktop.

Select an option

Save 100daysofdevops/0702642db634d284df755ef04b6d501b to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
SERVICENAME="httpd"
netstat -antulp|grep "$SERVICENAME"
SERVICESTATUS=`echo $?`
if [ "$SERVICESTATUS" != 0 ]
then
systemctl start $SERVICENAME
echo "$SERVICENAME started"
else
echo "$SERVICENAME is already running"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment