如何使 systemctl 单元(或服务)随系统启动(启动时)

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

我的 .service 文件中有这些选项:

[Unit]
Description=Atualizador de Sincronizacao

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

但它不随系统一起启动(例如 sshd 那样)所以我每次都需要 运行 一个 "systemctl start" 命令。

我需要在这个单元中添加什么选项才能随系统启动?

尝试:

systemctl enable yourservice

需要本机的 [Install] 部分,我在其中添加了 WantedBy=multi-user.target,以便在系统启动时启动服务。

最后,我不得不使用 Marshall Whittaker 给我的命令启用该装置:

systemctl enable myservice.service