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