I have a simple systemd service that is activated by system socket.
It's as simple as that (a little simplified):
$ systemctl cat example.socket # /usr/lib/systemd/system/example.socket [Unit] Description=Example Server socket [Socket] ListenStream=80 Accept=true [Install] WantedBy=sockets.target $ systemctl cat example@.service # /usr/lib/systemd/system/example@.service [Unit] Description=Example Server [Service] StandardInput=socket StandardOutput=socket StandardError=journal ExecStart=/usr/libexec/example User=example
Now what I want is to implement a basic access restriction by time. I.e. I want to limit the time a day the socket/service can be activated/reached from the outside, so it's only available at certain times a day, e.g.
I know I can use
systemctl edit to override the options, but I did not found an option to set, actually. I looked through the man page regarding system sockets and the only options regarding times are
TriggerLimitIntervalSec or so, which do not do what I want.
To compare this, the little oldish tool
xinetdx, which can do the same i.e. listen on a socket and start a process (server) on demand has an option called
access_times, which can be used to specify when a service should be available.
But using this as another tool (/dependency) is not a thing I'd like. I'd aim for an integrated way into systemd.