systemctl force order with before

Jav asked:

I want to create a systemctl service that mounts partitions required by lighttpd. In the my-service.service file, I wrote the following:




But when I want to enable it, I have the following error printed in syslog:

systemd[1]: Reloading.
systemd[1]: /etc/systemd/system/my-service.service:2: Failed to add dependency on lighttpd, ignoring: Invalid argument

I don’t understand how I can force lighttpd to be launched after my-service

From the manual:

Before=: The units listed in this directive will not be started
         until the current unit is marked as started if they are
         activated at the same time. This does not imply a dependency
         relationship and must be used in conjunction with one of the
         above directives if this is desired.

My answer:

The name of the unit is lighttpd.service, not just lighttpd, so that is what you need to specify.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.