【发布时间】:2017-05-09 16:02:04
【问题描述】:
我有一个运行 Ubuntu 16.04.1x64 的 DO droplet,我正在尝试将 IPFS 作为 systemd 服务运行。我已经按照here 的说明创建了一个用户“connor”并安装了 IPFS。我将服务作为“ipfs.service”存储在 ~/.config/systemd/user/ipfs.service 中,如下所示:
[Unit]
Description=IPFS Daemon
[Service]
Type=simple
ExecStart=/usr/local/bin/ipfs daemon
ExecStop=/usr/bin/pkill ipfs
Restart=always
User=Connor
[Install]
WantedBy=default.target
奇怪的是,如果我运行 systemctl --user start ipfs 它启动得很好。但是,运行 systemctl --user daemon-reload 然后 systemctl --user enable ipfs 我得到错误:
执行操作失败:没有那个文件或目录
但是,如果我运行 systemctl enable /home/connor/.config/systemd/user/ipfs.service -f 它运行得很好。我可以重新启动并运行 IPFS 命令就好了。我想以用户身份运行它,也想了解我做错了什么。
【问题讨论】:
-
您是否正在使用
connor用户执行命令?请注意,使用 sudo 执行命令可能会将用户更改为root。
标签: service systemd systemctl ipfs