You are not logged in.
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:
psd.service
psd-resync.service
psd-resync.timer
So the user starts psd.service and both psd-resync.{service,timer} get brought 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?
Last edited by graysky (2020-04-25 11:46:51)
Offline
Have you tried replacing this line in psd-resync.service:
PartOf=psd.serviceWith:
Requires=psd.serviceYour links are wrong btw, psd-resync.service points to psd.service.
Jin, Jîyan, Azadî
Offline
I corrected the links, thanks. I also ended up trying a different strategy retaining the files as-is: https://github.com/graysky2/profile-syn … 3d5cb19429
Basically, psd.service now has an ExecStart= that will error out if there is a problem. If all is well, it returns 0 and psd.service pulls in psd-resync.timer which in turn starts psd-resync.service which does the initial sync. If the first service errors out, so does the 2nd one. The only issue I find with this setup now is that psd-resync.timer is still active even if psd-resync.service is in an error state... any way to make the timer die if the service dies?
Last edited by graysky (2020-04-25 11:46:28)
Offline