Skip to content

Instantly share code, notes, and snippets.

@ngtrieuvi92
Created June 2, 2020 11:21
Show Gist options
  • Save ngtrieuvi92/4867c71ccd6d59c34ca8786dcf4d5354 to your computer and use it in GitHub Desktop.
Save ngtrieuvi92/4867c71ccd6d59c34ca8786dcf4d5354 to your computer and use it in GitHub Desktop.
[watch and reboot nginx] #nginx #autorestart
STATUS="$(systemctl is-active nginx)"
if [ "${STATUS}" = "active" ]; then
echo "Execute your tasks ....."
curl --retry 3 https://hc-ping.com/<>
else
echo " Service not running.... so exiting "
systemctl start nginx
curl --retry 3 https://hc-ping.com/<>
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment