systemctl enable xxxx
我有三个 docker 容器,我创建了 systemd 脚本以在启动时运行。我已经为所有三个服务运行了,我systemctl reenable xxxx
也尝试了。我根据 docker 文档创建了脚本。如果我使用 运行脚本service xxx start
,脚本运行良好。每当我重新启动时,docker 服务都会正常运行,但这三个脚本仍处于加载状态但不活动状态:
● guacd.service - Redis container
Loaded: loaded (/etc/systemd/system/guacd.service; enabled; vendor preset: enabled)
Active: inactive (dead)
我的脚本的组成/etc/systemd/system/guacd.service
:
[Unit]
Description=Redis container
Requires=docker.service
After=docker.service
[Service]
Restart=always
ExecStart=/usr/bin/docker start -a guacd
ExecStop=/usr/bin/docker stop -t 2 guacd
[Install]
WantedBy=local.target
答案1
是吗WantedBy=local.target
?也许吧WantedBy=local-fs.target
https://www.freedesktop.org/software/systemd/man/systemd.special.html#local-fs.target