[systemd-devel] timed events

David Strauss david at davidstrauss.net
Fri Jun 29 09:20:39 PDT 2012


On Thu, Jun 28, 2012 at 11:01 PM, Alexander E. Patrakov
<patrakov at gmail.com> wrote:
> So the logic, as I understand it, should be as follows: run bgpd if
> the administrator has not prohibited this due to maintenance or
> similar reasons, and the periodically-executed (?) dead-man's-switch
> script doesn't say that bgpd should not run.

You could also have a dead-mans-switch.service that declares
bgpd.service's dependency on it. If dead-mans-switch.service fails,
bgpd.service will get shut down. As long as dead-mans-switch.service
exits with a non-zero code, it will even get marked as "failed," which
is probably a boon in your use case. Restarting bgpd.service would be
manual after dead-mans-switch.service failure.

If you *did* want bgpd.service to restart when the connection gets
re-enabled, dead-mans-switch.service can depend on bgpd.service with
bgpd.service configured to run only when required by dependencies.
dead-mans-switch.service can exit with code 1 on failure, and systemd
can attempt to revive dead-mans-switch.service on a configurable
schedule (say, every 10 minutes) in the unit.

Having a timer-based service start/stop bgpd.service works fine. I
just wanted to offer a dependency-based take.

-- 
David Strauss
   | david at davidstrauss.net


More information about the systemd-devel mailing list