systemd 在启动时找不到用户文件

systemd 在启动时找不到用户文件

我正在尝试在 Ubuntu 16.04 启动时运行脚本。

我正在使用以下命令来使用 systemd。

[Unit]
Description=ether miner
Requires=network.target
After=syslog.target network.target

[Service]
ExecStartPre=/usr/bin/amdcovc fanspeed:0,1,2,3,4,5=70
ExecStart=/bin/bash /home/moe/Desktop/claymore_ether/start.bash

[Install]
WantedBy=multi-user.target

sudo systemctl start ether我登录用户后就可以运行该文件。

但是,由于我尚未登录系统,因此它不会在重启时运行该文件。

我收到以下错误。

● ether.service - ether miner
   Loaded: loaded (/etc/systemd/system/ether.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since တေး 2018-01-25 14:22:48 +0630; 5min ago
  Process: 1165 ExecStart=/bin/bash /home/moe/Desktop/claymore_ether/start.bash (code=exited, status=127)
  Process: 1142 ExecStartPre=/usr/bin/amdcovc fanspeed:0,1,2,3,4,5=70 (code=exited, status=0/SUCCESS)
 Main PID: 1165 (code=exited, status=127)

ဇန် 25 14:22:48 miner1.local amdcovc[1142]: Setting fanspeed to 70% for adapter 1 at thermal controller 0
ဇန် 25 14:22:48 miner1.local amdcovc[1142]: Setting fanspeed to 70% for adapter 2 at thermal controller 0
ဇန် 25 14:22:48 miner1.local amdcovc[1142]: Setting fanspeed to 70% for adapter 3 at thermal controller 0
ဇန် 25 14:22:48 miner1.local amdcovc[1142]: Setting fanspeed to 70% for adapter 4 at thermal controller 0
ဇန် 25 14:22:48 miner1.local amdcovc[1142]: Setting fanspeed to 70% for adapter 5 at thermal controller 0
ဇန် 25 14:22:48 miner1.local systemd[1]: Started ether miner.
ဇန် 25 14:22:48 miner1.local bash[1165]: /bin/bash: /home/moe/Desktop/claymore_ether/start.bash: No such file or director
ဇန် 25 14:22:48 miner1.local systemd[1]: ether.service: Main process exited, code=exited, status=127/n/a
ဇန် 25 14:22:48 miner1.local systemd[1]: ether.service: Unit entered failed state.
ဇန် 25 14:22:48 miner1.local systemd[1]: ether.service: Failed with result 'exit-code'.

并且/home/moe/Desktop/claymore_ether/start.bash存在,因为我可以/bin/bash /home/moe/Desktop/claymore_ether/start.bash毫无问题地运行。

我如何确保 systemd 有权访问/home/moe文件夹?

当 systemd 执行命令时,该文件夹似乎/home/moe尚未挂载。

谢谢。

相关内容