1
0

nfsd.init 933 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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" && 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/exportfs -r
  20. /usr/sbin/mountd
  21. /usr/sbin/nfsd
  22. if [ ${nfs_server_version} -eq 4 ];then
  23. mkdir -p /var/lib/nfs/rpc_pipefs
  24. mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
  25. /usr/sbin/idmapd
  26. /usr/sbin/svcgssd
  27. fi
  28. ;;
  29. stop)
  30. kill $(pgrep -f /usr/sbin/nfsd)
  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. fi
  36. ;;
  37. restart)
  38. sh $0 stop
  39. sh $0 start
  40. ;;
  41. *)
  42. echo "Usage: $0 {start | stop | restart}"
  43. exit 1
  44. ;;
  45. esac
  46. exit $?