Skip to content

Instantly share code, notes, and snippets.

@zarza
Created January 19, 2018 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zarza/6407825471e4d24899cb0686b1e91bb2 to your computer and use it in GitHub Desktop.
Save zarza/6407825471e4d24899cb0686b1e91bb2 to your computer and use it in GitHub Desktop.
If this found your service stopped it will try to start it
#!/bin/bash
echo '[Start service if it is down]'
echo
# ZARZA | A HEAD OF OUR TIME
# https://zarza.com
service=nginx
if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
then
echo "$service is up!"
else
/etc/init.d/$service start
fi
echo
echo '==========================================='
echo 'Brought to you thanks to https://zarza.com'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment