Felipe Jhony Felipe Jhony - 1 year ago 118
Linux Question

How to make a systemctl unit (or service) start with system (on boot)

I have these options on my .service file:

Description=Atualizador de Sincronizacao


but it does not start with the system (like sshd does, for instance) so I need to run a "systemctl start" command every time.

What option do I need to add in this unit so it starts with the system?

Answer Source

Required the [Install] section on this unit where I added a WantedBy=multi-user.target so the service would start when the system starts.

Finally I had to enable the unit with the command that Marshall Whittaker gave me:

systemctl enable myservice.service
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download