[systemd-devel] If systemd service fails how to get a dependency service to fail also

John graysky at archlinux.us
Sat Apr 25 10:55:40 UTC 2020


On Sat, Apr 25, 2020 at 2:19 AM Andrei Borzenkov <arvidjaar at gmail.com> wrote:
>
> ps.service does not call any script on startup.
> >
> > 1) psd.service remains in an active state
> > 2) psd-resync.timer remains active
> >
> > I'd like:
> > 1) both psd.service and psd-resync.service to both end in an error state.
> > 2) psd-resync.timer to get deactivated
> >
>
> Assuming service that fails is psd-resync.service, as far as I can tell
> the only way is to add BindsTo=psd-resync.service to both psd.service
> and psd-resync.timer.

Thank you for the review and for the reply.  Since posting, I changed
psd.service  to have an ExecStart and I also modified the units with a
BindsTo per your suggestion.

1. Now psd.service calls the script in a new check mode.  If no error
code is returned, psd-resync.timer calls psd-resync.service and I get
the desired effect.
2. If the script ends in an error, psd.service fails and
psd-resync.service and timer also fail.

Please take a look at the units now.  Is everything sane?
https://github.com/graysky2/profile-sync-daemon/tree/e002b321acff67fcbe41e1bd2ee2563776729813/init


More information about the systemd-devel mailing list