]>
Commit | Line | Data |
---|---|---|
559d3ad2 MT |
1 | #!/bin/sh |
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 | |
071e69cc | 12 | . /var/ipfire/nfs/nfs-server |
559d3ad2 MT |
13 | |
14 | case "$1" in | |
15 | start) | |
16 | boot_mesg "Starting NFS mountd..." | |
17 | loadproc /usr/sbin/rpc.mountd | |
18 | ||
19 | boot_mesg "Starting NFS nfsd..." | |
20 | loadproc /usr/sbin/rpc.nfsd -p $PORT $PROCESSES | |
21 | ||
22 | boot_mesg "Starting NFS statd..." | |
23 | loadproc /usr/sbin/rpc.statd | |
24 | ||
25 | if [ "$QUOTAS" = "yes" ]; then | |
26 | boot_mesg "Starting NFS rquotad..." | |
27 | loadproc /usr/sbin/rpc.rquotad | |
28 | fi | |
29 | ||
668ea5d3 SS |
30 | # NFSD support requires kernel 2.6 or newer. |
31 | /bin/uname -r | /bin/grep -E "^2.6|^3" 2>&1 > /dev/null | |
559d3ad2 MT |
32 | if [ $? = 0 ]; then |
33 | boot_mesg "Mounting nfsd virtual filesystem..." | |
34 | /bin/mount -t nfsd none /proc/fs/nfsd 2>&1 > /dev/null | |
35 | evaluate_retval | |
36 | fi | |
37 | ||
38 | # Make ceratin that the list is refreshed on | |
39 | # a restart. | |
40 | boot_mesg "Exporting NFS Filesystems..." | |
41 | /usr/sbin/exportfs -ra 2>&1 > /dev/null | |
42 | evaluate_retval | |
43 | ;; | |
44 | ||
45 | stop) | |
46 | boot_mesg "Stopping NFS statd..." | |
47 | killproc /usr/sbin/rpc.statd | |
48 | ||
49 | boot_mesg "Stopping NFS nfsd..." | |
50 | # nfsd needs HUP.... | |
51 | killproc nfsd HUP | |
52 | ||
53 | boot_mesg "Stopping NFS mountd..." | |
54 | killproc /usr/sbin/rpc.mountd | |
55 | ||
56 | if [ "$QUOTAS" = "yes" ]; then | |
57 | boot_mesg "Stopping NFS rquotad..." | |
58 | killproc /usr/sbin/rpc.rquotad | |
59 | fi | |
60 | ||
61 | boot_mesg "Refreshing NFS Exported Filesystems..." | |
62 | /usr/sbin/exportfs -au 2>&1 > /dev/null | |
63 | evaluate_retval | |
64 | ||
668ea5d3 SS |
65 | # NFSD support requires kernel 2.6 or newer. |
66 | /bin/uname -r | /bin/grep -E "^2.6|^3" 2>&1 > /dev/null | |
559d3ad2 MT |
67 | if [ $? = 0 ]; then |
68 | boot_mesg "Unmounting NFS Virtual Filesystem..." | |
69 | /bin/umount /proc/fs/nfsd 2>&1 > /dev/null | |
70 | evaluate_retval | |
71 | fi | |
72 | ||
73 | # Remove a pid file that isn't done automatically | |
74 | boot_mesg "Removing the rpc.statd pid file if it exists" | |
75 | if [ -f /var/run/rpc.statd.pid ]; then | |
76 | rm -f /var/run/rpc.statd.pid | |
77 | fi | |
78 | ;; | |
79 | ||
80 | reload) | |
81 | boot_mesg "Reloading NFS Server..." | |
82 | /usr/sbin/exportfs -ra | |
83 | evaluate_retval | |
84 | ;; | |
85 | ||
86 | restart) | |
87 | $0 stop | |
88 | sleep 1 | |
89 | $0 start | |
90 | ;; | |
91 | ||
92 | status) | |
93 | statusproc /usr/sbin/rpc.mountd | |
94 | ## Special case for nfsd with no full path | |
95 | statusproc nfsd | |
96 | statusproc /usr/sbin/rpc.statd | |
97 | if [ "$QUOTA" = "yes" ]; then | |
98 | statusproc rpc.rquotad | |
99 | fi | |
100 | ;; | |
101 | ||
102 | *) | |
103 | echo "Usage: $0 {start|stop|reload|restart|status}" | |
104 | exit 1 | |
105 | ;; | |
106 | esac | |
107 | ||
108 | # End $rc_base/init.d/nfs-server |