Skip to content

Instantly share code, notes, and snippets.

@gittmaan
Forked from progrium/gist:5734609
Created December 1, 2015 03:58
Show Gist options
  • Save gittmaan/0cf16fb0a1b3bb15ea3c to your computer and use it in GitHub Desktop.
Save gittmaan/0cf16fb0a1b3bb15ea3c to your computer and use it in GitHub Desktop.
Let unprivileged processes easily restart/reload Nginx without sudo or setuid hacks
# run this as root
while [ 1 ]; do echo | 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