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

John graysky at archlinux.us
Fri Apr 24 13:57:42 UTC 2020


I'd like to have systemd (user mode) call a bash script with different
tokens under two conditions:
1) When the user starts/stops a service (token would be either "sync"
or "unsync")
2) When a timer tells it to run (token would be "sync")

Thus far, I have been accomplishing these with 1 service and 1
service/timer combo:

All three files can be found here for reference:
https://github.com/graysky2/profile-sync-daemon/tree/ce290b54069b015879f53d631f82ed97bfe73d47/init

So the user starts psd.service and both psd-resync.{service,timer} get
activated and run as expected.  The problem is when the script that
psd.service calls ends in an error state...

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

I've been through the man pages for systemd.service and systemd.timer
to the point where I am confused who to achieve this.  What is the
right strategy using services and a timer to deliver on this?


More information about the systemd-devel mailing list