Skip to content

Instantly share code, notes, and snippets.

@fnkr
Last active February 27, 2016 19:16
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 fnkr/cdccb6681aaefab42c43 to your computer and use it in GitHub Desktop.
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.
#!/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