[7df280d] | 1 | #!/bin/bash
|
---|
[7125722] | 2 | # Begin $rc_base/init.d/nfs-server
|
---|
| 3 |
|
---|
| 4 | # Based on sysklogd script from LFS-3.1 and earlier.
|
---|
| 5 | # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
|
---|
| 6 |
|
---|
| 7 | #$LastChangedBy: bdubbs $
|
---|
| 8 | #$Date: 2006-09-10 19:41:47 -0500 (Sun, 10 Sep 2006) $
|
---|
| 9 |
|
---|
| 10 | . /etc/sysconfig/rc
|
---|
| 11 | . $rc_functions
|
---|
| 12 | . /etc/sysconfig/nfs-server
|
---|
| 13 |
|
---|
| 14 | case "$1" in
|
---|
| 15 | start)
|
---|
| 16 | boot_mesg "Starting NFS mountd..."
|
---|
| 17 | loadproc /usr/sbin/rpc.mountd
|
---|
| 18 |
|
---|
[ad1a0bc] | 19 | if [ "$NFS4" = "yes" ]; then
|
---|
[eec6401] | 20 | boot_mesg "Mounting rpc_pipefs virtual filesystem..."
|
---|
| 21 | /bin/mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs 2>&1 > /dev/null
|
---|
| 22 | evaluate_retval
|
---|
| 23 |
|
---|
[ad1a0bc] | 24 | boot_mesg "Starting NFS4 idmapd..."
|
---|
| 25 | loadproc /usr/sbin/rpc.idmapd
|
---|
| 26 |
|
---|
| 27 | boot_mesg "Starting NFS4 svcgssd..."
|
---|
| 28 | loadproc /usr/sbin/rpc.svcgssd
|
---|
| 29 | fi
|
---|
| 30 |
|
---|
[7125722] | 31 | boot_mesg "Starting NFS nfsd..."
|
---|
| 32 | loadproc /usr/sbin/rpc.nfsd -p $PORT $PROCESSES
|
---|
| 33 |
|
---|
| 34 | boot_mesg "Starting NFS statd..."
|
---|
| 35 | loadproc /usr/sbin/rpc.statd
|
---|
| 36 |
|
---|
| 37 | if [ "$QUOTAS" = "yes" ]; then
|
---|
| 38 | boot_mesg "Starting NFS rquotad..."
|
---|
| 39 | loadproc /usr/sbin/rpc.rquotad
|
---|
| 40 | fi
|
---|
| 41 |
|
---|
| 42 | # NFSD support only in 2.6 kernel
|
---|
| 43 | /bin/uname -r | /bin/grep "2.6" 2>&1 > /dev/null
|
---|
| 44 | if [ $? = 0 ]; then
|
---|
| 45 | boot_mesg "Mounting nfsd virtual filesystem..."
|
---|
| 46 | /bin/mount -t nfsd none /proc/fs/nfsd 2>&1 > /dev/null
|
---|
| 47 | evaluate_retval
|
---|
| 48 | fi
|
---|
| 49 |
|
---|
| 50 | # Make ceratin that the list is refreshed on
|
---|
| 51 | # a restart.
|
---|
| 52 | boot_mesg "Exporting NFS Filesystems..."
|
---|
| 53 | /usr/sbin/exportfs -ra 2>&1 > /dev/null
|
---|
| 54 | evaluate_retval
|
---|
| 55 | ;;
|
---|
| 56 |
|
---|
| 57 | stop)
|
---|
| 58 | boot_mesg "Stopping NFS statd..."
|
---|
| 59 | killproc /usr/sbin/rpc.statd
|
---|
| 60 |
|
---|
| 61 | boot_mesg "Stopping NFS nfsd..."
|
---|
| 62 | # nfsd needs HUP....
|
---|
| 63 | killproc nfsd HUP
|
---|
| 64 |
|
---|
[ad1a0bc] | 65 | if [ "$NFS4" = "yes" ]; then
|
---|
| 66 | boot_mesg "Stopping NFS svcgssd..."
|
---|
| 67 | killproc /usr/sbin/rpc.svcgssd
|
---|
| 68 |
|
---|
| 69 | boot_mesg "Stopping NFS idmapd..."
|
---|
| 70 | killproc /usr/sbin/rpc.idmapd
|
---|
[eec6401] | 71 |
|
---|
| 72 | boot_mesg "Unmounting rpc_pipefs virtual filesystem..."
|
---|
| 73 | /bin/umount /var/lib/nfs/rpc_pipefs 2>&1 > /dev/null
|
---|
| 74 | evaluate_retval
|
---|
[ad1a0bc] | 75 | fi
|
---|
| 76 |
|
---|
[7125722] | 77 | boot_mesg "Stopping NFS mountd..."
|
---|
| 78 | killproc /usr/sbin/rpc.mountd
|
---|
| 79 |
|
---|
| 80 | if [ "$QUOTAS" = "yes" ]; then
|
---|
| 81 | boot_mesg "Stopping NFS rquotad..."
|
---|
| 82 | killproc /usr/sbin/rpc.rquotad
|
---|
| 83 | fi
|
---|
| 84 |
|
---|
| 85 | boot_mesg "Refreshing NFS Exported Filesystems..."
|
---|
| 86 | /usr/sbin/exportfs -au 2>&1 > /dev/null
|
---|
| 87 | evaluate_retval
|
---|
| 88 |
|
---|
| 89 | # NFSD support only in 2.6 kernel
|
---|
| 90 | /bin/uname -r | /bin/grep "2.6" 2>&1 > /dev/null
|
---|
| 91 | if [ $? = 0 ]; then
|
---|
| 92 | boot_mesg "Unmounting NFS Virtual Filesystem..."
|
---|
| 93 | /bin/umount /proc/fs/nfsd 2>&1 > /dev/null
|
---|
| 94 | evaluate_retval
|
---|
| 95 | fi
|
---|
| 96 |
|
---|
| 97 | # Remove a pid file that isn't done automatically
|
---|
| 98 | boot_mesg "Removing the rpc.statd pid file if it exists"
|
---|
| 99 | if [ -f /var/run/rpc.statd.pid ]; then
|
---|
| 100 | rm -f /var/run/rpc.statd.pid
|
---|
| 101 | fi
|
---|
| 102 | ;;
|
---|
| 103 |
|
---|
| 104 | reload)
|
---|
| 105 | boot_mesg "Reloading NFS Server..."
|
---|
| 106 | /usr/sbin/exportfs -ra
|
---|
| 107 | evaluate_retval
|
---|
| 108 | ;;
|
---|
| 109 |
|
---|
| 110 | restart)
|
---|
| 111 | $0 stop
|
---|
| 112 | sleep 1
|
---|
| 113 | $0 start
|
---|
| 114 | ;;
|
---|
| 115 |
|
---|
| 116 | status)
|
---|
| 117 | statusproc /usr/sbin/rpc.mountd
|
---|
| 118 | ## Special case for nfsd with no full path
|
---|
[ad1a0bc] | 119 | if [ "$NFS4" = "yes" ]; then
|
---|
| 120 | statusproc /usr/sbin/rpc.idmapd
|
---|
| 121 | statusproc /usr/sbin/rps.svcgssd
|
---|
| 122 | fi
|
---|
[7125722] | 123 | statusproc nfsd
|
---|
| 124 | statusproc /usr/sbin/rpc.statd
|
---|
| 125 | if [ "$QUOTA" = "yes" ]; then
|
---|
| 126 | statusproc rpc.rquotad
|
---|
| 127 | fi
|
---|
| 128 | ;;
|
---|
| 129 |
|
---|
| 130 | *)
|
---|
| 131 | echo "Usage: $0 {start|stop|reload|restart|status}"
|
---|
| 132 | exit 1
|
---|
| 133 | ;;
|
---|
| 134 | esac
|
---|
| 135 |
|
---|
| 136 | # End $rc_base/init.d/nfs-server
|
---|