Skip to content

Instantly share code, notes, and snippets.

@HowardMei
Created September 5, 2013 10: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 HowardMei/6448672 to your computer and use it in GitHub Desktop.
Save HowardMei/6448672 to your computer and use it in GitHub Desktop.
nginx auto restart
#!/bin/bash
#
# Wrapper based on MiteshShah script
# https://github.com/rtCamp/easyengine/issues/3
#
# Start nginx
/usr/sbin/nginx
# Start supervising the config
while true
do
inotifywait --exclude .swp -e create /etc/nginx/sites-enabled
nginx -t
if [ $? -eq 0 ]
then
echo "Reloading Nginx Configuration"
/usr/sbin/nginx -s reload
else
echo "Error config"
fi
done
@MiteshShah
Copy link

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment