Last active
February 27, 2016 19:16
-
-
Save fnkr/cdccb6681aaefab42c43 to your computer and use it in GitHub Desktop.
httpd reloader. Tells nginx (or any other httpd) to reload configuration if file has been created.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
reload_command="/usr/sbin/nginx -s reload" | |
watchfile="/tmp/please_reload_httpd" | |
while read file; do | |
if [ "$file" = "$(basename "$watchfile")" ]; then | |
$reload_command | |
rm "$watchfile" | |
fi | |
done < <(exec inotifywait -e create --format '%f' --quiet --monitor "$(dirname "$watchfile")") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment