nfsd.init 974 B

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