wok-current annotate nfs-utils/stuff/etc/init.d/nfsd @ rev 25379
updated uget (2.2.1 -> 2.2.3)
author | Hans-G?nter Theisgen |
---|---|
date | Sat Jul 30 15:37:46 2022 +0100 (2022-07-30) |
parents | 7f188676b59c |
children | 2994fe300985 |
rev | line source |
---|---|
pascal@7285 | 1 #!/bin/sh |
al@19161 | 2 # /etc/init.d/nfsd: Start, stop and restart NFS daemon on SliTaz, at boot |
pascal@7285 | 3 # time or with the command line. |
pascal@7285 | 4 # |
pascal@7285 | 5 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS |
pascal@7285 | 6 # variable of /etc/rcS.conf. |
pascal@7285 | 7 # |
pascal@7285 | 8 . /etc/init.d/rc.functions |
pascal@7285 | 9 |
pascal@7285 | 10 NAME=NFSd |
al@19159 | 11 DESC="$(_ '%s daemon' NFS)" |
pascal@7285 | 12 DAEMON=/usr/sbin/rpc.nfsd |
pascal@7285 | 13 PID_FILE=/var/run/nfsd.pid |
pascal@7285 | 14 OPTION="8" |
pascal@7285 | 15 [ -n "$NFSD_OPTION" ] || OPTION="$NFSD_OPTION" |
pascal@7285 | 16 |
pascal@7285 | 17 stop_warning() |
pascal@7285 | 18 { |
al@19159 | 19 echo "Warning: filesystems are unexported but nfsd and lockd processes are still alive..." |
pascal@7285 | 20 } |
pascal@7285 | 21 |
pascal@7285 | 22 case "$1" in |
pascal@7285 | 23 start) |
pascal@7285 | 24 if active_pidfile $PID_FILE nfsd ; then |
al@19159 | 25 _ '%s is already running.' $NAME |
pascal@7285 | 26 exit 1 |
pascal@7285 | 27 fi |
al@19159 | 28 action 'Starting %s: %s...' "$DESC" $NAME |
pascal@7285 | 29 portmap="$(pidof portmap)" |
pascal@7285 | 30 if [ -n "$portmap" ]; then |
al@19159 | 31 kill $portmap |
al@19159 | 32 sleep 2 |
pascal@7285 | 33 fi |
pascal@7285 | 34 [ -n "$(pidof rpcbind)" ] || rpcbind |
pascal@7285 | 35 modprobe nfsd |
al@19159 | 36 mount -t nfsd nfsd /proc/fs/nfsd 2>/dev/null |
pascal@7285 | 37 /usr/sbin/exportfs -r |
pascal@7285 | 38 $DAEMON $OPTION |
pascal@7285 | 39 pidof nfsd | awk '{print $1}' > $PID_FILE |
pascal@7285 | 40 /usr/sbin/rpc.mountd |
pascal@7285 | 41 status |
pascal@7285 | 42 ;; |
pascal@7285 | 43 stop) |
pascal@7285 | 44 if ! active_pidfile $PID_FILE nfsd ; then |
al@19159 | 45 _ '%s is not running.' $NAME |
pascal@7285 | 46 exit 1 |
pascal@7285 | 47 fi |
al@19159 | 48 action 'Stopping %s: %s...' "$DESC" $NAME |
pascal@7285 | 49 killall rpc.mountd |
pascal@7285 | 50 killall nfsd |
pascal@7285 | 51 killall lockd |
pascal@7285 | 52 /usr/sbin/exportfs -au |
pascal@7285 | 53 /usr/sbin/exportfs -f |
pascal@7285 | 54 stop_warning # FIXME |
pascal@7285 | 55 rm $PID_FILE |
pascal@7285 | 56 status |
pascal@7285 | 57 ;; |
pascal@7285 | 58 restart) |
pascal@7285 | 59 if ! active_pidfile $PID_FILE nfsd ; then |
al@19159 | 60 _ '%s is not running.' $NAME |
pascal@7285 | 61 exit 1 |
pascal@7285 | 62 fi |
al@19159 | 63 action 'Restarting %s: %s...' "$DESC" $NAME |
pascal@7285 | 64 killall rpc.mountd |
pascal@7285 | 65 killall nfsd |
pascal@7285 | 66 killall lockd |
pascal@7285 | 67 /usr/sbin/exportfs -au |
pascal@7285 | 68 /usr/sbin/exportfs -f |
pascal@7285 | 69 sleep 2 |
pascal@7285 | 70 /usr/sbin/exportfs -r |
pascal@7285 | 71 $DAEMON $OPTION |
pascal@7285 | 72 pidof nfsd | awk '{print $1}' > $PID_FILE |
pascal@7285 | 73 /usr/sbin/rpc.mountd |
pascal@7285 | 74 status |
pascal@7285 | 75 ;; |
pascal@7285 | 76 *) |
al@19159 | 77 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]" |
al@19159 | 78 newline |
pascal@7285 | 79 exit 1 |
pascal@7285 | 80 ;; |
pascal@7285 | 81 esac |
pascal@7285 | 82 |
pascal@7285 | 83 exit 0 |