Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
I assume that you have your Debian filesystem mounted somewhere? Can you simply run chroot /mountpoint systemctl enable myservice.service? –  Zoredache May 29 '13 at 1:21
    
Or rather systemd-nspawn -b -D /mountpoint instead of chroot – but in this case symlinking will be sufficient. –  Debilski Aug 25 at 16:02

1 Answer 1

up vote 4 down vote accepted

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/multi-user.target.wants/myservice.service'

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.