Skip to content

Instantly share code, notes, and snippets.

@larsbs
Forked from progrium/gist:5734609
Last active August 29, 2015 14:18
Show Gist options
  • Save larsbs/5b73663ec1efd52dffce to your computer and use it in GitHub Desktop.
Save larsbs/5b73663ec1efd52dffce to your computer and use it in GitHub Desktop.
# run this as root (as root user, not with sudo)
while [ 1 ]; do echo | sudo -u nonprivilegeduser nc -l -U /tmp/reload_nginx && /etc/init.d/nginx reload; done
# or as an upstart job
script
echo | nc -l -U /tmp/reload_nginx && /etc/init.d/nginx reload
end script
respawn
# now any process can run this or do the equivalent with sockets to trigger reload
nc -U /tmp/reload_nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment