1. 생성/etc/systemd/system/nfs-common.service

1. 생성/etc/systemd/system/nfs-common.service

내 Raspbian(Debian Jessie 기반)에서는 NFS 마운트를 위해 부팅 시 시작해야 하기 때문에 부팅 rpcbind및 서비스 시 시작해야 합니다.nfs-commonautofs

Debian Jessie가 이제 로 이동했기 때문에 systemd문제를 피하기 위해 해당 3개 서비스(rpcbind, nfs-commond, autofs)를 올바른 순서로 시작하는 가장 좋은 방법을 알고 싶습니다.

NFS 공유를 수동으로 마운트하면 작동합니다. 또한 rpcbind 및 nfs-common이 이미 실행되어 autofs 서비스를 사용할 때도 작동합니다.

autofs는 시스템 단위 스크립트를 사용합니다. 다른 2개 서비스에 대해서는 init.d 스크립트를 만들어야 합니까, 아니면 시스템 단위 파일을 만들어야 합니까? 어떻게 쓸 수 있나요?

답변1

문제의 원인은 부족하기 때문입니다.체계화된구성 파일. 에 기초매트 그랜트의 게시물debian-devel수행해야 할 단계는 다음 과 같습니다 .

1. 생성/etc/systemd/system/nfs-common.service

cat >/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

2. 생성/etc/systemd/system/rpcbind.service

cat >/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

3. 생성/etc/tmpfiles.d/rpcbind.conf

cat >/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

4. 시작 시 실행되도록 서비스 구성

systemctl enable rpcbind.service
systemctl enable nfs-common

관련 정보