0

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

[Unit]
Before=lighttpd

[Service]
ExecStart=/home/user/mount_script
Type=notify
User=user
Group=user

[Install]
WantedBy=multi-user.target

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.
Jav
  • 293
  • 3
  • 13

1 Answers1

1

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

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972