[systemd-devel] How to stop service by timer
Tomasz Torcz
tomek at pipebreaker.pl
Mon Sep 12 18:33:53 UTC 2016
On Mon, Sep 12, 2016 at 09:13:26PM +0300, Федор Короткий wrote:
> Hi,
>
> We are trying to setup a service that runs every day from 10:00 to 18:45.
>
> Starting is not a problem, we just used timer. But our solution for
> stopping the service seems ugly. We have second service with
> Type=oneshot which runs "systemctl stop first.service" at 18.45(by
> using second timer).
>
> Is there a better way to achieve this?
That's basically the way. Or you can make second service ”empty”
(execing /bin/true) with Conflicts=first.service.
I would be glad to see .timers extended with TimerAction= option,
being ”start” be default, but allowing stop, isolate, restart etc.
Maybe open and RFE issue on github?
--
Tomasz Torcz Only gods can safely risk perfection,
xmpp: zdzichubg at chrome.pl it's a dangerous thing for a man. -- Alia
More information about the systemd-devel
mailing list