Could anyone give me directions as for how to write a shell script that constantly listens to a port and when someone/something sends an HTTP request to that port, it executes an action as sudo?
I need to restart nginx from another server and SSHing to this server isn't an option. So I'm looking for means to achieve that. My idea is to have Server A constantly listening to a port and when there's a request on that port sent from Server B, Server A restarts nginx.
Security shouldn't be a problem. I'll write the shell script on Ubuntu 14.0.4 LTS