Debian
通過 Systemd 安裝 Gluster
我需要一個 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
在處理該服務請求之前,該類型將等到其他所有內容都已分派。我有一種預感,這與時間有關,這是唯一真正糾正了這個問題的事情。[Unit] Description=Gluster Mount [Service] Type=idle ExecStart=/bin/mount /data TimeoutSec=0 StandardOutput=tty RemainAfterExit=yes SysVStartPriority=99 [Install] WantedBy=multi-user.target