Felipe Jhony
Felipe Jhony

Reputation: 83

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

I have these options on my .service file:

[Unit]
Description=Atualizador de Sincronizacao

[Service]
TimeoutStartSec=0
ExecStart=/opt/sn_home/sincronizador/bin/jarupdater.sh

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?

Upvotes: 4

Views: 1162

Answers (2)

Felipe Jhony
Felipe Jhony

Reputation: 83

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

Upvotes: 4

oxagast
oxagast

Reputation: 417

Try:

systemctl enable yourservice

Upvotes: 2

Related Questions