我想创建一个systemctl
挂载所需分区的服务lighttpd
。在my-service.service
文件中,我写了以下内容:
[Unit]
Before=lighttpd
[Service]
ExecStart=/home/user/mount_script
Type=notify
User=user
Group=user
[Install]
WantedBy=multi-user.target
但是当我想启用它时,我打印了以下错误syslog
:
systemd[1]: Reloading.
systemd[1]: /etc/systemd/system/my-service.service:2: Failed to add dependency on lighttpd, ignoring: Invalid argument
我不明白如何在...lighttpd
之后强制启动my-service
从手册:
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.