wok-6.x diff nfs-utils/stuff/etc/init.d/nfsd @ rev 7965
Up: dev86 0.2.1.29
author | Antoine Bodin <gokhlayeh@slitaz.org> |
---|---|
date | Mon Jan 17 17:24:02 2011 +0100 (2011-01-17) |
parents | |
children | 7f188676b59c |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/nfs-utils/stuff/etc/init.d/nfsd Mon Jan 17 17:24:02 2011 +0100 1.3 @@ -0,0 +1,84 @@ 1.4 +#!/bin/sh 1.5 +# /etc/init.d/nfsd: Start, stop and restart NFS deamon on SliTaz, at boot 1.6 +# time or with the command line. 1.7 +# 1.8 +# To start daemon at boot time, just put the right name in the $RUN_DAEMONS 1.9 +# variable of /etc/rcS.conf. 1.10 +# 1.11 +. /etc/init.d/rc.functions 1.12 + 1.13 +NAME=NFSd 1.14 +DESC="NFS Daemon" 1.15 +DAEMON=/usr/sbin/rpc.nfsd 1.16 +PID_FILE=/var/run/nfsd.pid 1.17 +OPTION="8" 1.18 +[ -n "$NFSD_OPTION" ] || OPTION="$NFSD_OPTION" 1.19 + 1.20 +stop_warning() 1.21 +{ 1.22 +echo "Warning: filesystems are unexported but nfsd and lockd processes are still alive..." 1.23 +} 1.24 + 1.25 +case "$1" in 1.26 + start) 1.27 + if active_pidfile $PID_FILE nfsd ; then 1.28 + echo "$NAME already running." 1.29 + exit 1 1.30 + fi 1.31 + echo -n "Starting $DESC: $NAME... " 1.32 + portmap="$(pidof portmap)" 1.33 + if [ -n "$portmap" ]; then 1.34 + kill $portmap 1.35 + sleep 2 1.36 + fi 1.37 + [ -n "$(pidof rpcbind)" ] || rpcbind 1.38 + modprobe nfsd 1.39 + mount -t nfsd nfsd /proc/fs/nfsd 2> /dev/null 1.40 + /usr/sbin/exportfs -r 1.41 + $DAEMON $OPTION 1.42 + pidof nfsd | awk '{print $1}' > $PID_FILE 1.43 + /usr/sbin/rpc.mountd 1.44 + status 1.45 + ;; 1.46 + stop) 1.47 + if ! active_pidfile $PID_FILE nfsd ; then 1.48 + echo "$NAME is not running." 1.49 + exit 1 1.50 + fi 1.51 + echo -n "Stopping $DESC: $NAME... " 1.52 + killall rpc.mountd 1.53 + killall nfsd 1.54 + killall lockd 1.55 + /usr/sbin/exportfs -au 1.56 + /usr/sbin/exportfs -f 1.57 + stop_warning # FIXME 1.58 + rm $PID_FILE 1.59 + status 1.60 + ;; 1.61 + restart) 1.62 + if ! active_pidfile $PID_FILE nfsd ; then 1.63 + echo "$NAME is not running." 1.64 + exit 1 1.65 + fi 1.66 + echo -n "Restarting $DESC: $NAME... " 1.67 + killall rpc.mountd 1.68 + killall nfsd 1.69 + killall lockd 1.70 + /usr/sbin/exportfs -au 1.71 + /usr/sbin/exportfs -f 1.72 + sleep 2 1.73 + /usr/sbin/exportfs -r 1.74 + $DAEMON $OPTION 1.75 + pidof nfsd | awk '{print $1}' > $PID_FILE 1.76 + /usr/sbin/rpc.mountd 1.77 + status 1.78 + ;; 1.79 + *) 1.80 + echo "" 1.81 + echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" 1.82 + echo "" 1.83 + exit 1 1.84 + ;; 1.85 +esac 1.86 + 1.87 +exit 0