1 | #!/bin/bash |
---|
2 | # Begin $rc_base/init.d/nfs-server |
---|
3 | |
---|
4 | # Based on sysklogd script from LFS-3.1 and earlier. |
---|
5 | # Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org |
---|
6 | |
---|
7 | #$LastChangedBy: bdubbs $ |
---|
8 | #$Date: 2006-09-10 19:41:47 -0500 (Sun, 10 Sep 2006) $ |
---|
9 | |
---|
10 | . /etc/sysconfig/rc |
---|
11 | . $rc_functions |
---|
12 | . /etc/sysconfig/nfs-server |
---|
13 | |
---|
14 | case "$1" in |
---|
15 | start) |
---|
16 | boot_mesg "Starting NFS mountd..." |
---|
17 | loadproc /usr/sbin/rpc.mountd |
---|
18 | |
---|
19 | if [ "$NFS4" = "yes" ]; then |
---|
20 | boot_mesg "Starting NFS4 idmapd..." |
---|
21 | loadproc /usr/sbin/rpc.idmapd |
---|
22 | |
---|
23 | boot_mesg "Starting NFS4 svcgssd..." |
---|
24 | loadproc /usr/sbin/rpc.svcgssd |
---|
25 | fi |
---|
26 | |
---|
27 | boot_mesg "Starting NFS nfsd..." |
---|
28 | loadproc /usr/sbin/rpc.nfsd -p $PORT $PROCESSES |
---|
29 | |
---|
30 | boot_mesg "Starting NFS statd..." |
---|
31 | loadproc /usr/sbin/rpc.statd |
---|
32 | |
---|
33 | if [ "$QUOTAS" = "yes" ]; then |
---|
34 | boot_mesg "Starting NFS rquotad..." |
---|
35 | loadproc /usr/sbin/rpc.rquotad |
---|
36 | fi |
---|
37 | |
---|
38 | # NFSD support only in 2.6 kernel |
---|
39 | /bin/uname -r | /bin/grep "2.6" 2>&1 > /dev/null |
---|
40 | if [ $? = 0 ]; then |
---|
41 | boot_mesg "Mounting nfsd virtual filesystem..." |
---|
42 | /bin/mount -t nfsd none /proc/fs/nfsd 2>&1 > /dev/null |
---|
43 | evaluate_retval |
---|
44 | fi |
---|
45 | |
---|
46 | # Make ceratin that the list is refreshed on |
---|
47 | # a restart. |
---|
48 | boot_mesg "Exporting NFS Filesystems..." |
---|
49 | /usr/sbin/exportfs -ra 2>&1 > /dev/null |
---|
50 | evaluate_retval |
---|
51 | ;; |
---|
52 | |
---|
53 | stop) |
---|
54 | boot_mesg "Stopping NFS statd..." |
---|
55 | killproc /usr/sbin/rpc.statd |
---|
56 | |
---|
57 | boot_mesg "Stopping NFS nfsd..." |
---|
58 | # nfsd needs HUP.... |
---|
59 | killproc nfsd HUP |
---|
60 | |
---|
61 | if [ "$NFS4" = "yes" ]; then |
---|
62 | boot_mesg "Stopping NFS svcgssd..." |
---|
63 | killproc /usr/sbin/rpc.svcgssd |
---|
64 | |
---|
65 | boot_mesg "Stopping NFS idmapd..." |
---|
66 | killproc /usr/sbin/rpc.idmapd |
---|
67 | fi |
---|
68 | |
---|
69 | boot_mesg "Stopping NFS mountd..." |
---|
70 | killproc /usr/sbin/rpc.mountd |
---|
71 | |
---|
72 | if [ "$QUOTAS" = "yes" ]; then |
---|
73 | boot_mesg "Stopping NFS rquotad..." |
---|
74 | killproc /usr/sbin/rpc.rquotad |
---|
75 | fi |
---|
76 | |
---|
77 | boot_mesg "Refreshing NFS Exported Filesystems..." |
---|
78 | /usr/sbin/exportfs -au 2>&1 > /dev/null |
---|
79 | evaluate_retval |
---|
80 | |
---|
81 | # NFSD support only in 2.6 kernel |
---|
82 | /bin/uname -r | /bin/grep "2.6" 2>&1 > /dev/null |
---|
83 | if [ $? = 0 ]; then |
---|
84 | boot_mesg "Unmounting NFS Virtual Filesystem..." |
---|
85 | /bin/umount /proc/fs/nfsd 2>&1 > /dev/null |
---|
86 | evaluate_retval |
---|
87 | fi |
---|
88 | |
---|
89 | # Remove a pid file that isn't done automatically |
---|
90 | boot_mesg "Removing the rpc.statd pid file if it exists" |
---|
91 | if [ -f /var/run/rpc.statd.pid ]; then |
---|
92 | rm -f /var/run/rpc.statd.pid |
---|
93 | fi |
---|
94 | ;; |
---|
95 | |
---|
96 | reload) |
---|
97 | boot_mesg "Reloading NFS Server..." |
---|
98 | /usr/sbin/exportfs -ra |
---|
99 | evaluate_retval |
---|
100 | ;; |
---|
101 | |
---|
102 | restart) |
---|
103 | $0 stop |
---|
104 | sleep 1 |
---|
105 | $0 start |
---|
106 | ;; |
---|
107 | |
---|
108 | status) |
---|
109 | statusproc /usr/sbin/rpc.mountd |
---|
110 | ## Special case for nfsd with no full path |
---|
111 | if [ "$NFS4" = "yes" ]; then |
---|
112 | statusproc /usr/sbin/rpc.idmapd |
---|
113 | statusproc /usr/sbin/rps.svcgssd |
---|
114 | fi |
---|
115 | statusproc nfsd |
---|
116 | statusproc /usr/sbin/rpc.statd |
---|
117 | if [ "$QUOTA" = "yes" ]; then |
---|
118 | statusproc rpc.rquotad |
---|
119 | fi |
---|
120 | ;; |
---|
121 | |
---|
122 | *) |
---|
123 | echo "Usage: $0 {start|stop|reload|restart|status}" |
---|
124 | exit 1 |
---|
125 | ;; |
---|
126 | esac |
---|
127 | |
---|
128 | # End $rc_base/init.d/nfs-server |
---|