Sample Header Ad - 728x90

Deactivate a systemd service after idle time

15 votes
3 answers
5339 views
I want a service to start on demand rather than on boot. To do that I could use systemd socket activation (with the service and socket files). But this is a resource limited server, so after some time (e.g. 1 hour) of inactivity, I want to stop the service (until it is triggered again). How can I do that? I looked through some of [the documentation](https://www.freedesktop.org/software/systemd/man/systemd.socket.html) but I can't figure out if this is supported. --- Update: Assuming this is unsupported, the use case is still probably quite common. What would be a good way / workaround to achieve this?
Asked by lonix (1965 rep)
Sep 23, 2018, 02:23 PM
Last activity: May 3, 2022, 10:21 AM