wok-current view nfs-utils/stuff/etc/init.d/nfsd @ rev 10995
Up: atkmm to 2.22.5.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Thu Oct 13 02:45:26 2011 +0000 (2011-10-13) |
parents | |
children | 7f188676b59c |
line source
1 #!/bin/sh
2 # /etc/init.d/nfsd: Start, stop and restart NFS deamon 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="NFS Daemon"
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 echo "$NAME already running."
26 exit 1
27 fi
28 echo -n "Starting $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 echo "$NAME is not running."
46 exit 1
47 fi
48 echo -n "Stopping $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 echo "$NAME is not running."
61 exit 1
62 fi
63 echo -n "Restarting $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 echo ""
78 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
79 echo ""
80 exit 1
81 ;;
82 esac
84 exit 0