在我的Raspbian (基于Debian )上,我需要在引导rpcbind和nfs-common服务时启动,因为我需要它们在引导时启动autofs,以便安装NFS。
既然Debian现在已经迁移到systemd,我想知道以正确的顺序启动这3种服务(rpcbind、nfs-逗号、autofs)的最佳方法,以避免出现问题。
如果我手动挂载NFS共享,它就能工作。在使用rpcbind和nfs的autofs服务时,它也可以工作--这是已经启动和运行的通用的。
autofs使用systemd单元脚本。关于其他两个服务,我应该创建init.d脚本还是必须创建systemd单元文件?我怎么写呢?
发布于 2016-10-14 07:01:11
造成此问题的原因是缺乏系统配置文件。基于马特·格兰特发帖 on debian-devel,需要执行以下步骤。
/etc/systemd/system/nfs-common.servicecat >/etc/systemd/system/nfs-common.service <<\EOF
[Unit]
Description=NFS Common daemons
Wants=remote-fs-pre.target
DefaultDependencies=no
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/etc/init.d/nfs-common start
ExecStop=/etc/init.d/nfs-common stop
[Install]
WantedBy=sysinit.target
EOF/etc/systemd/system/rpcbind.servicecat >/etc/systemd/system/rpcbind.service <<\EOF
[Unit]
Description=RPC bind portmap service
After=systemd-tmpfiles-setup.service
Wants=remote-fs-pre.target
Before=remote-fs-pre.target
DefaultDependencies=no
[Service]
ExecStart=/sbin/rpcbind -f -w
KillMode=process
Restart=on-failure
[Install]
WantedBy=sysinit.target
Alias=portmap
EOF/etc/tmpfiles.d/rpcbind.confcat >/etc/tmpfiles.d/rpcbind.conf <<\EOF
#Type Path Mode UID GID Age Argument
d /run/rpcbind 0755 root root - -
f /run/rpcbind/rpcbind.xdr 0600 root root - -
f /run/rpcbind/portmap.xdr 0600 root root - -
EOF时运行
systemctl enable rpcbind.service
systemctl enable nfs-commonhttps://unix.stackexchange.com/questions/263331
复制相似问题