Bug 54659

Summary: RFE: Extend logic for stopping units (As for OnFailure) [ w/ patch ]
Product: systemd Reporter: Oleksii Shevchuk <public.avatar>
Component: generalAssignee: systemd-bugs
Status: RESOLVED WONTFIX QA Contact: systemd-bugs
Severity: enhancement    
Priority: medium CC: alexandre, radek
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Add OnStop to [Unit]
Add OnStopRestoreConflicts

Description Oleksii Shevchuk 2012-09-08 05:13:14 UTC
In some cases, starting or stopping of some service requires starting/restarting other. One example - you have some service A that replaces service B with Conflicts= rule, and then B stopped
Comment 1 Oleksii Shevchuk 2012-11-02 19:50:17 UTC
Created attachment 69457 [details] [review]
Add OnStop to [Unit]

+ Add OnStop event // at job stop/done
Comment 2 Oleksii Shevchuk 2012-11-03 17:19:45 UTC
Created attachment 69493 [details] [review]
Add OnStopRestoreConflicts

Extends previous patch. Add optional support for restoring stopped by conflict  resolution deps, on successful stop conflicing unit. (Oh.) 


i.e.

user > cat dep1.target
[Unit]
Description=dep1
OnStopRestoreConflicts=yes

user > cat dep2.target
[Unit]
Description=dep2
Conflicts=dep1.target

start dep2.target
// dep2 started
start dep1.target
// dep1 started
// dep2 stopped
// dep2 added to dep1 OnStopRestoreConflicts deps
stop dep1.target
// dep1 stopped
// dep2 started
// dep2 removed from dep1 OnStopRestoreConflicts deps
Comment 3 Lennart Poettering 2016-06-07 10:35:27 UTC
I am not convinced adding this would be a good idea, as this would make systemd Turing complete, and I am pretty sure we really shouldn't be.

I hope that makes sense?

Closing hence. Sorry.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.