【发布时间】:2017-12-17 09:20:46
【问题描述】:
我制作了一个简单的 systemd 服务文件来在启动时运行命令:
[Unit]
Description=Executable Service
After=multi-user.target
[Service]
Type=oneshot
ExecStart=/path/to/command
它只需要在启动时运行一次。然后我启用了它:
systemctl enable executable.service
systemctl is-enabled executable.service
enabled
然后我重新启动服务器(它运行的是 CentOS 7.3)并且它没有运行,我只是得到:
systemctl status executable.service
● executable.service - Executable Service
Loaded: loaded (/usr/lib/systemd/system/executable.service; enabled; vendor preset: disabled)
Active: inactive (dead)
一旦我手动启动服务:
systemctl start executable.service
它可以正常工作,就像我期望的那样。
【问题讨论】:
标签: systemd