Exit caddy after inactivity / idle time automatically

Hello,

I start caddy using systemd socket activation and it works well.

Now I would like to stop (exit) caddy after inactivity / idle time automatically. With this, I can stop the caddy service and all dependent services and wait for another systemd socket activation.

How do I do this?

Thanks,

Chris