我想有一个自定义的服务,我已经放在/ lib / systemd / system开机启动,但是我只知道如何运行
systemctl enable myservice.service
但我希望能够在不启动到实际文件系统的情况下执行此操作,以便我可以自动部署此configuration。
systemctl enable所做的是为从/lib/systemd/system文件夹指定给/etc/systemd/multi-user.target.wants的服务创build一个符号链接,因此您可以简单地执行以下操作:
ln -s '/lib/systemd/system/myservice.service' '/etc/systemd/multi-user.target.wants/myservice.service'