Bug 87323 - RFE: WorkingDirectory= should imply RequiresMountsFor= for the specified paths
Summary: RFE: WorkingDirectory= should imply RequiresMountsFor= for the specified paths
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium enhancement
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-15 10:06 UTC by Stephen Benjamin
Modified: 2016-06-07 11:11 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Stephen Benjamin 2014-12-15 10:06:01 UTC
Let's say I have a service target called 'pulp_celerybeat' that requires some content from the /var/lib/pulp directory in order to start.  

This directory contains RPM content (and quite a lot of it), so users may want to move this to a network share.

When I do, this service no longer starts because it can happen that /var/lib/pulp isn't mounted.

I've fixed this by creating:
  /etc/systemd/system/pulp_celerybeat.service.d/amendments.conf

With:
  [Unit]
  RequireMountsFor=/var/lib/pulp

Easy enough.

But systemd knows about all the mount targets.  It also knows that pulp_celerybeat uses /var/lib/pulp by this in the unit file:

  [Service]
  WorkingDirectory=/var/lib/pulp/celery/

Would it be possible to do this dependency management automatically?

Alternatively, supporting some directive like "RequiresDir" that we could ship in the packaged unit files would be useful, so if a user does move our storage to a network share, systemd would set the right mount dependencies automatically.
Comment 1 Lennart Poettering 2016-06-07 11:11:52 UTC
This has been implemented a while back.


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.