blob: 893b1e49a67d6027363d486678c2da13aaca2e4b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#!/bin/sh
#
# nfs This shell script takes care of starting and stopping
# the NFS services. Stolen from RedHat FC5.
[ -x /usr/sbin/rpc.statd ] || exit 0
[ -x /usr/sbin/rpc.nfsd ] || exit 0
[ -x /usr/sbin/rpc.mountd ] || exit 0
[ -x /usr/sbin/exportfs ] || exit 0
mkdir -p /var/lock/subsys
mkdir -p /run/nfs/sm
mkdir -p /run/nfs/sm.bak
touch /run/nfs/rmtab
CFG_FILE=/etc/default/nfsd
NR_THREADS=2
if [ -f "${CFG_FILE}" ]; then
. "${CFG_FILE}"
fi
start() {
# Start daemons.
printf "Starting NFS statd: "
rpc.statd
[ $? = 0 ] && echo "OK" || echo "FAIL"
touch /var/lock/subsys/nfslock
printf "Starting NFS services: "
/usr/sbin/exportfs -r
[ $? = 0 ] && echo "OK" || echo "FAIL"
printf "Starting NFS daemon: "
rpc.nfsd ${NR_THREADS}
[ $? = 0 ] && echo "OK" || echo "FAIL"
printf "Starting NFS mountd: "
rpc.mountd
[ $? = 0 ] && echo "OK" || echo "FAIL"
touch /var/lock/subsys/nfs
}
stop() {
# Stop daemons.
printf "Shutting down NFS mountd: "
killall -q rpc.mountd 2>/dev/null
[ $? = 0 ] && echo "OK" || echo "FAIL"
printf "Shutting down NFS daemon: "
killall -q nfsd 2>/dev/null
[ $? = 0 ] && echo "OK" || echo "FAIL"
printf "Shutting down NFS services: "
/usr/sbin/exportfs -au
[ $? = 0 ] && echo "OK" || echo "FAIL"
printf "Stopping NFS statd: "
killall -q rpc.statd 2>/dev/null
[ $? = 0 ] && echo "OK" || echo "FAIL"
rm -f /var/lock/subsys/nfs
rm -f /var/run/rpc.statd.pid
rm -f /var/lock/subsys/nfslock
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
reload)
/usr/sbin/exportfs -r
touch /var/lock/subsys/nfs
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac
exit 0
|