我需要一个 gluster 卷以在启动时挂载。将它放在 /etc/fstab 中不会产生可靠的结果。
我设置了以下 systemd 服务:
[Unit]
Description=Gluster Mount
[Service]
Type=oneshot
ExecStart=/bin/mount /data
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
当此服务在启动时运行时,它会返回以下内容:
root@web1:~# systemctl status gluster-mount.service
â gluster-mount.service - Gluster Mount
Loaded: loaded (/etc/systemd/system/gluster-mount.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2018-03-13 04:05:43 UTC; 3min 20s ago
Process: 627 ExecStart=/bin/mount /data (code=exited, status=1/FAILURE)
Main PID: 627 (code=exited, status=1/FAILURE)
Mar 13 04:05:39 web1 systemd[1]: Starting Gluster Mount...
Mar 13 04:05:43 web1 systemd[1]: gluster-mount.service: Main process exited, code=exited, status=1/FAILURE
Mar 13 04:05:43 web1 systemd[1]: Failed to start Gluster Mount.
Mar 13 04:05:43 web1 systemd[1]: gluster-mount.service: Unit entered failed state.
Mar 13 04:05:43 web1 systemd[1]: gluster-mount.service: Failed with result 'exit-code'.
当我登录后在此服务上发出“重新启动”时,它工作正常。我错过了什么?
因此,更改类型以
idle
解决问题。根据定义,idle
在处理该服务请求之前,该类型将等到其他所有内容都已分派。我有一种预感,这与时间有关,这是唯一真正纠正了这个问题的事情。