summaryrefslogtreecommitdiffstats
path: root/base/nfs-utils/nfs-server.sh
diff options
context:
space:
mode:
authorThierry N <thierryn1 at hispeed dot ch>2009-08-07 14:34:16 +0200
committerThierry N <thierryn1 at hispeed dot ch>2009-08-07 14:34:16 +0200
commit7d3362ec31e6f95c80cd14f148185bbf369453d6 (patch)
treefdc6ebf1e0ce2326e8ae95270f57f14b6aaa791b /base/nfs-utils/nfs-server.sh
parent1b975b55bf2820be6e468754000ef6bc580baac8 (diff)
downloadnutyx-pakxe-7d3362ec31e6f95c80cd14f148185bbf369453d6.tar.gz
nutyx-pakxe-7d3362ec31e6f95c80cd14f148185bbf369453d6.tar.bz2
nutyx-pakxe-7d3362ec31e6f95c80cd14f148185bbf369453d6.tar.xz
nutyx-pakxe-7d3362ec31e6f95c80cd14f148185bbf369453d6.zip
Ajout de nfs-utils#1.2.0-1
Diffstat (limited to 'base/nfs-utils/nfs-server.sh')
-rw-r--r--base/nfs-utils/nfs-server.sh113
1 files changed, 113 insertions, 0 deletions
diff --git a/base/nfs-utils/nfs-server.sh b/base/nfs-utils/nfs-server.sh
new file mode 100644
index 000000000..dc48b387b
--- /dev/null
+++ b/base/nfs-utils/nfs-server.sh
@@ -0,0 +1,113 @@
+#!/bin/sh
+# Begin $rc_base/init.d/nfs-server
+
+# Based on sysklogd script from LFS-3.1 and earlier.
+# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
+
+#$LastChangedBy: bdubbs $
+#$Date: 2006-09-10 19:41:47 -0500 (Sun, 10 Sep 2006) $
+
+. /etc/sysconfig/rc
+. $rc_functions
+. /etc/sysconfig/nfs-server
+newuser=nobody
+newgroup=nogroup
+newid=99
+getent group $newgroup || /usr/bin/groupadd -g $newid $newgroup
+getent passwd $newuser || /usr/bin/useradd -c "Unprivileged Nobody" \
+-g $newgroup -u $newid -d /dev/null -s /bin/false $newuser
+case "$1" in
+ start)
+ boot_mesg "Starting NFS mountd..."
+ loadproc /usr/sbin/rpc.mountd
+
+ boot_mesg "Starting NFS nfsd..."
+ loadproc /usr/sbin/rpc.nfsd -p $PORT $PROCESSES
+
+ boot_mesg "Starting NFS statd..."
+ loadproc /usr/sbin/rpc.statd
+
+ if [ "$QUOTAS" = "yes" ]; then
+ boot_mesg "Starting NFS rquotad..."
+ loadproc /usr/sbin/rpc.rquotad
+ fi
+
+ # NFSD support only in 2.6 kernel
+ /bin/uname -r | /bin/grep "2.6" 2>&1 > /dev/null
+ if [ $? = 0 ]; then
+ boot_mesg "Mounting nfsd virtual filesystem..."
+ /bin/mount -t nfsd none /proc/fs/nfsd 2>&1 > /dev/null
+ evaluate_retval
+ fi
+
+ # Make ceratin that the list is refreshed on
+ # a restart.
+ boot_mesg "Exporting NFS Filesystems..."
+ /usr/sbin/exportfs -ra 2>&1 > /dev/null
+ evaluate_retval
+ ;;
+
+ stop)
+ boot_mesg "Stopping NFS statd..."
+ killproc /usr/sbin/rpc.statd
+
+ boot_mesg "Stopping NFS nfsd..."
+ # nfsd needs HUP....
+ killproc nfsd HUP
+
+ boot_mesg "Stopping NFS mountd..."
+ killproc /usr/sbin/rpc.mountd
+
+ if [ "$QUOTAS" = "yes" ]; then
+ boot_mesg "Stopping NFS rquotad..."
+ killproc /usr/sbin/rpc.rquotad
+ fi
+
+ boot_mesg "Refreshing NFS Exported Filesystems..."
+ /usr/sbin/exportfs -au 2>&1 > /dev/null
+ evaluate_retval
+
+ # NFSD support only in 2.6 kernel
+ /bin/uname -r | /bin/grep "2.6" 2>&1 > /dev/null
+ if [ $? = 0 ]; then
+ boot_mesg "Unmounting NFS Virtual Filesystem..."
+ /bin/umount /proc/fs/nfsd 2>&1 > /dev/null
+ evaluate_retval
+ fi
+
+ # Remove a pid file that isn't done automatically
+ boot_mesg "Removing the rpc.statd pid file if it exists"
+ if [ -f /var/run/rpc.statd.pid ]; then
+ rm -f /var/run/rpc.statd.pid
+ fi
+ ;;
+
+ reload)
+ boot_mesg "Reloading NFS Server..."
+ /usr/sbin/exportfs -ra
+ evaluate_retval
+ ;;
+
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+
+ status)
+ statusproc /usr/sbin/rpc.mountd
+ ## Special case for nfsd with no full path
+ statusproc nfsd
+ statusproc /usr/sbin/rpc.statd
+ if [ "$QUOTA" = "yes" ]; then
+ statusproc rpc.rquotad
+ fi
+ ;;
+
+ *)
+ echo "Usage: $0 {start|stop|reload|restart|status}"
+ exit 1
+ ;;
+esac
+
+# End $rc_base/init.d/nfs-server