nfsd.init 944 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/sh
  2. #PKG nfs-utils
  3. #INIT 70
  4. . /etc/rc.conf
  5. case $1 in
  6. autostop) ;;
  7. autostart)
  8. test x"${portmap:-NO}" = x"NO" && test x"${rpcbind:-NO}" = x"NO" && exit 0
  9. test x"${nfs_server:-NO}" = x"NO" && exit 0
  10. exec sh $0 start
  11. ;;
  12. start)
  13. /bin/mkdir -p /var/lib/nfs/v4recovery
  14. /bin/touch /var/lib/nfs/rmtab
  15. /bin/touch /var/lib/nfs/etab
  16. /bin/touch /var/lib/nfs/xtab
  17. /bin/touch /var/lib/nfs/sm
  18. chown nfs:nfs /var/lib/nfs/sm
  19. /usr/sbin/nfsd
  20. /usr/sbin/mountd
  21. if [ ${nfs_server_version} -eq 4 ];then
  22. mkdir -p /var/lib/nfs/rpc_pipefs
  23. mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
  24. /usr/sbin/idmapd
  25. /usr/sbin/svcgssd
  26. fi
  27. ;;
  28. stop)
  29. kill $(pgrep -f /usr/sbin/mountd)
  30. if [ ${nfs_server_version} -eq 4 ];then
  31. kill $(pgrep -f /usr/sbin/idmapd)
  32. kill $(pgrep -f /usr/sbin/svcgssd)
  33. umount /var/lib/nfs/rpc_pipefs
  34. fi
  35. ;;
  36. restart)
  37. sh $0 stop
  38. sh $0 start
  39. ;;
  40. *)
  41. echo "Usage: $0 {start | stop | restart}"
  42. exit 1
  43. ;;
  44. esac
  45. exit $?