Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

systemctl enable doesn't copy service file to right place. #161

Open
ladyrick opened this issue Jun 27, 2023 · 1 comment
Open

systemctl enable doesn't copy service file to right place. #161

ladyrick opened this issue Jun 27, 2023 · 1 comment

Comments

@ladyrick
Copy link
Contributor

When I run

systemctl enable $(readlink -f my_service.service)

The real systemctl command will create a link point to this file on the right place.

But this systemctl will not. You need to place the service file yourself.

@gdraheim
Copy link
Owner

Interesting, I did never use it but it is in fact documented.

https://www.freedesktop.org/software/systemd/man/systemctl.html#enable%20UNIT%E2%80%A6

shows "enable UNIT…, enable PATH…" and explains:

This command expects either valid unit names (in which case various unit file directories are automatically searched for unit files with appropriate names), or absolute paths to unit files (in which case these files are read directly). If a specified unit file is located outside of the usual unit file directories, an additional symlink is created, linking it into the unit configuration path, thus ensuring it is found when requested by commands such as start.

This is related to

https://www.freedesktop.org/software/systemd/man/systemctl.html#link%20PATH%E2%80%A6

"link PATH…"
Link a unit file that is not in the unit file search path into the unit file search path. This command expects an absolute path to a unit file. The effect of this may be undone with disable. The effect of this command is that a unit file is made available for commands such as start, even though it is not installed directly in the unit search path. The file system where the linked unit files are located must be accessible when systemd is started (e.g. anything underneath /home/ or /var/ is not allowed, unless those directories are located on the root file system).

And in fact "link" is not implemented by systemctl.py either. The link-path would be prerequisite for the enable-path functionality. I don't see any practical use for it but I take patches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants