Automatically exit nginx if no requests have came for one hour

Hello,

My nginx server is automatically started by a systemd socket / service, on a Debian server.

Now, I would like to know the best way to cleanly exit nginx, if no requests have happened, let’s say for one hour.

Does nginx has anything already implemented, or I should do it myself ?

I can use a lua script, or a systemd time. My access logs are sent to the system journal.

Thank you.

I end up writing a Python wrapper to spawn the service, monitor the exchanged traffic, and terminate the process after some inactivity time.

Thanks for the follow up on this!