问题原文
原帖链接 · ngart · CC BY-SA 3.0
I want to have a custom service that I've placed into /lib/systemd/system start at boot, but th eonly way I know how at the moment is to run
systemctl enable myservice.service
but I would like to be able to do this without booting into the actual file system so that I can automate the deployment of this configuration.
已采纳解答
原帖链接 · j883376 · CC BY-SA 4.0
What systemctl enable does is creates a symlink for the service you specify from the /lib/systemd/system folder to /etc/systemd/multi-user.target.wants, so you can simply do:
ln -s '/lib/systemd/system/myservice.service' '/etc/systemd/system/multi-user.target.wants/myservice.service'
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
