systemd services question
-
In this lesson: https://app.itpro.tv/course/lpic1-linux-administrator-101500/managing-servicessystemd-lpic1 , at 15:41, Don shows his service's unit file and a "[Install]" section. There is a WantedBy=multi-user.target key-value pair.
Is this really required when we enable the service and the symbolic link is created? What is the purpose of the Install section and the WantedBy key? Does setting this here allow the "systemctl enable" to work and do they work together or is it redundant? Thanks.
-
I do believe this document has the answers you seek. Please let us know! Thanks! https://www.unixsysadmin.com/systemd-user-services/
-
A couple things:
Some distros (and some versions within a distro) will work w/o the [Install] section. However, you will want it to keep things consistent.
One exception: if the service is supposed to be started by another systemd unit (e.g. a timer), you will want to leave the [Install] section off the .service file and specify it in the .timer. The same is true with .mount and .automount units (the Install goes in the automount in this case). -
Thanks so much Joshua! Great stuff!