Systemd unit activate vs enable
To start
(activate) a service , you will run the command systemctl start my_service.service
, this will start the service immediately in the current session.
To enable
a service at boot , you will run systemctl enable my_service.service
.
Enable one or more units or unit instances. This will create a set of symlinks, as encoded in the "[Install]" sections of the indicated unit files. After the symlinks have been created, the system manager configuration is reloaded (in a way equivalent to daemon-reload), in order to ensure the changes are taken into account immediately
The /usr/lib/systemd/system/
contains init
scripts , when you type systemctl enable
to start a service at boot it will be linked to /etc/systemd/system/
.
#systemctl enable my_service.service
ln -s '/usr/lib/systemd/system/my_service.service' '/etc/systemd/system/multi-user.target.wants/my_service.service'
systemctl enable
configures the system to start the service at next reboot (with caveats around correct target states, etc).
systemctl start
starts (activates) the service immediately.
So if you want a service to start now and on every reboot then you need to both enable
and start
the service.