我在coreOS中设置了mount.service
,但是当我重启服务器时,我得到了:
$ sudo -i
Failed Units: 1
mount.service
araweelo ~ # systemctl status mount
● mount.service - Mount share service
Loaded: loaded (/etc/systemd/system/mount.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2016-06-22 10:45:58 BST; 50s ago
Main PID: 695 (code=exited, status=32)
Jun 22 10:45:58 araweelo systemd[1]: Starting Mount share service...
Jun 22 10:45:58 araweelo mount.cifs[695]: mount error(101): Network is unreachable
Jun 22 10:45:58 araweelo mount.cifs[695]: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Jun 22 10:45:58 araweelo systemd[1]: mount.service: Main process exited, code=exited, status=32/n/a
Jun 22 10:45:58 araweelo systemd[1]: Failed to start Mount share service.
Jun 22 10:45:58 araweelo systemd[1]: mount.service: Unit entered failed state.
Jun 22 10:45:58 araweelo systemd[1]: mount.service: Failed with result 'exit-code'.
这是我的mount.service文件
araweelo ~ # vim /etc/systemd/system/mount.service
[Unit]
Description=Mount share service
Wants=network-online.target
After=network.target
[Service]
Type=oneshot
RemainAfterExit=yes
TimeoutStartSec=0
ExecStart=/opt/bin/mount.cifs //192.168.10.4/Apps/pegasus/operaII/Data/C /ccc/smb -o domain=server-apps.opera.local,credentials=/home/opera/.smbcredentials,uid=1000,gid=1000,ro
[Install]
WantedBy=multi-user.target
RequiredBy=docker.service
然后:
araweelo ~ # systemctl enable mount
araweelo ~ # systemctl start mount
araweelo ~ # df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.4G 0 3.4G 0% /dev
tmpfs 3.5G 0 3.5G 0% /dev/shm
tmpfs 3.5G 460K 3.5G 1% /run
tmpfs 3.5G 0 3.5G 0% /sys/fs/cgroup
/dev/sda9 114G 44G 65G 41% /
/dev/sda3 985M 589M 345M 64% /usr
tmpfs 3.5G 0 3.5G 0% /media
/dev/sda1 128M 66M 62M 52% /boot
tmpfs 3.5G 0 3.5G 0% /tmp
/dev/sda6 108M 52K 99M 1% /usr/share/oem
//192.168.10.4/Apps/pegasus/operaII/Data/C 558G 246G 313G 44% /ccc/smb
如果我重新启动服务器,我会得到Failed to start Mount share service
非常感谢任何关于我错过的建议。
答案 0 :(得分:0)
在黑暗中采取一点刺,但这两个应该匹配吗?
Wants=network-online.target
After=network.target
我知道要让After=
生效,您还需要一个匹配相同服务的Requires=
。也许这就是这种情况?