0

I create a "target" in /etc/systemd/system that is very simple

sp-example.target

[Unit]
Description=SP Example Target

[Install]
WantedBy=multi-user.target

I then create a directory called /etc/systemd/system/sp-example.target.wants. In this directory, I put a link to my service and restart the system. It doesn't start the service, but it does start the target. I move the link from this sp-example.target.wants directory into multi-user.target.wants and reboot and the service starts.

1
  • This folder /etc/systemd/system/sp-example.target.wants is actually a link to another disk. It seems that systemd mounts the disks later and may already be determining this folder is empty (bad link). Maybe I need a way to trigger systemd to rescan for the wants folder. Commented Sep 27, 2017 at 7:57

1 Answer 1

0

It appears that "wants" directories cannot be on another disk that is not yet mounted unless systemd is reloaded as follows after the disk is mounted.

systemctl daemon-reload
systemctl restart <service>

Putting this in a later rc5.d script causes the problem to be solved.

Reference: https://serverfault.com/questions/700862/do-systemd-unit-files-have-to-be-reloaded-when-modified

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.