nfs-server 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #!/bin/sh
  2. ########################################################################
  3. # Begin nfs-server
  4. #
  5. # Description : Start nfs server
  6. #
  7. # Authors : Ken Moffat - ken@linuxfromscratch.org
  8. # Bruce Dubbs - bdubbs@linuxfromscratch.org
  9. #
  10. # Version : LFS 7.0
  11. #
  12. ########################################################################
  13. ### BEGIN INIT INFO
  14. # Provides: nfs-server
  15. # Required-Start: rpcbind
  16. # Should-Start:
  17. # Required-Stop: rpcbind
  18. # Should-Stop:
  19. # Default-Start: 3 4 5
  20. # Default-Stop: 0 1 2 6
  21. # Short-Description: Starts the nfs server
  22. # Description: Starts the nfs server and exports directories.
  23. # X-LFS-Provided-By: BLFS / LFS 7.0
  24. ### END INIT INFO
  25. . /etc/rc.d/functions
  26. #$LastChangedBy: bdubbs $
  27. #$Date: 2017-01-27 11:55:21 -0600 (Fri, 27 Jan 2017) $
  28. . /etc/sysconfig/nfs-server
  29. case "$1" in
  30. start)
  31. log_info_msg "Starting NFS statd..."
  32. start_daemon /usr/sbin/rpc.statd --no-notify
  33. evaluate_retval
  34. log_info_msg "Starting NFS nfsd..."
  35. start_daemon /usr/sbin/rpc.nfsd -p $PORT $PROCESSES
  36. evaluate_retval
  37. if [ "$QUOTAS" = "yes" ]; then
  38. log_info_msg "Starting NFS rquotad..."
  39. start_daemon /usr/sbin/rpc.rquotad
  40. evaluate_retval
  41. fi
  42. log_info_msg "Starting NFS mountd..."
  43. start_daemon /usr/sbin/rpc.mountd
  44. evaluate_retval
  45. # Make certain that the list is refreshed on a restart.
  46. log_info_msg "Exporting NFS Filesystems..."
  47. /usr/sbin/exportfs -ra 2>&1 > /dev/null
  48. evaluate_retval
  49. ;;
  50. stop)
  51. log_info_msg "Removing NFS Exported Filesystems..."
  52. /usr/sbin/exportfs -au 2>&1 > /dev/null
  53. evaluate_retval
  54. if [ "$QUOTAS" = "yes" ]; then
  55. log_info_msg "Stopping NFS rquotad..."
  56. killproc /usr/sbin/rpc.rquotad
  57. evaluate_retval
  58. fi
  59. log_info_msg "Stopping NFS statd..."
  60. killproc /usr/sbin/rpc.statd
  61. evaluate_retval
  62. log_info_msg "Stopping NFS nfsd..."
  63. # nfsd needs HUP. Can't use killproc for kernel process.
  64. killall -HUP nfsd
  65. evaluate_retval
  66. log_info_msg "Stopping NFS mountd..."
  67. killproc /usr/sbin/rpc.mountd
  68. evaluate_retval
  69. # Remove a pid file that isn't done automatically
  70. if [ -f /var/run/rpc.statd.pid ]; then
  71. log_success_msg "Removing the rpc.statd pid file if it exists"
  72. rm -f /var/run/rpc.statd.pid
  73. fi
  74. ;;
  75. reload)
  76. log_info_msg "Reloading NFS Server..."
  77. /usr/sbin/exportfs -ra
  78. evaluate_retval
  79. ;;
  80. restart)
  81. $0 stop
  82. sleep 1
  83. $0 start
  84. ;;
  85. status)
  86. statusproc /usr/sbin/rpc.mountd
  87. ## Special case for nfsd with no full path
  88. statusproc nfsd
  89. statusproc /usr/sbin/rpc.statd
  90. if [ "$QUOTAS" = "yes" ]; then
  91. statusproc rpc.rquotad
  92. fi
  93. ;;
  94. *)
  95. echo "Usage: $0 {start|stop|reload|restart|status}"
  96. exit 1
  97. ;;
  98. esac
  99. # End /etc/init.d/nfs-server