source: bootscripts-standard/bootscripts/cblfs/init.d/nfs-server@ 2167cfe

Last change on this file since 2167cfe was 2167cfe, checked in by William Harrington <kb0iic@…>, 11 years ago

bootscripts are the scripts used for the sysvinit book.

  • Property mode set to 100644
File size: 3.1 KB
RevLine 
[2167cfe]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
14case "$1" in
15 start)
16 # NFSD support only in 2.6 kernel
17 /bin/uname -r | /bin/grep "^2.6" 2>&1 > /dev/null
18 if [ $? = 0 ]; then
19 boot_mesg "Mounting nfsd virtual filesystem..."
20 /bin/mount -t nfsd none /proc/fs/nfsd 2>&1 > /dev/null
21 evaluate_retval
22 fi
23
24 boot_mesg "Starting NFS mountd..."
25 loadproc /usr/sbin/rpc.mountd
26
27 if [ "$NFS4" = "yes" ]; then
28 boot_mesg "Mounting rpc_pipefs virtual filesystem..."
29 /bin/mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs 2>&1 > /dev/null
30 evaluate_retval
31
32 boot_mesg "Starting NFS4 idmapd..."
33 loadproc /usr/sbin/rpc.idmapd
34
35 boot_mesg "Starting NFS4 svcgssd..."
36 loadproc /usr/sbin/rpc.svcgssd
37 fi
38
39 boot_mesg "Starting NFS nfsd..."
40 loadproc /usr/sbin/rpc.nfsd -p $PORT $PROCESSES
41
42 boot_mesg "Starting NFS statd..."
43 loadproc /usr/sbin/rpc.statd
44
45 if [ "$QUOTAS" = "yes" ]; then
46 boot_mesg "Starting NFS rquotad..."
47 loadproc /usr/sbin/rpc.rquotad
48 fi
49
50 # Make ceratin that the list is refreshed on
51 # a restart.
52 boot_mesg "Exporting NFS Filesystems..."
53 /usr/sbin/exportfs -ra 2>&1 > /dev/null
54 evaluate_retval
55 ;;
56
57 stop)
58 boot_mesg "Stopping NFS statd..."
59 killproc /usr/sbin/rpc.statd
60
61 boot_mesg "Stopping NFS nfsd..."
62 loadproc /usr/sbin/rpc.nfsd 0
63
64 if [ "$NFS4" = "yes" ]; then
65 boot_mesg "Stopping NFS svcgssd..."
66 killproc /usr/sbin/rpc.svcgssd
67
68 boot_mesg "Stopping NFS idmapd..."
69 killproc /usr/sbin/rpc.idmapd
70
71 boot_mesg "Unmounting rpc_pipefs virtual filesystem..."
72 /bin/umount /var/lib/nfs/rpc_pipefs 2>&1 > /dev/null
73 evaluate_retval
74 fi
75
76 boot_mesg "Stopping NFS mountd..."
77 killproc /usr/sbin/rpc.mountd
78
79 if [ "$QUOTAS" = "yes" ]; then
80 boot_mesg "Stopping NFS rquotad..."
81 killproc /usr/sbin/rpc.rquotad
82 fi
83
84 boot_mesg "Refreshing NFS Exported Filesystems..."
85 /usr/sbin/exportfs -au 2>&1 > /dev/null
86 evaluate_retval
87
88 # Remove a pid file that isn't done automatically
89 boot_mesg "Removing the rpc.statd pid file if it exists"
90 if [ -f /var/run/rpc.statd.pid ]; then
91 rm -f /var/run/rpc.statd.pid
92 fi
93
94 # NFSD support only in 2.6 kernel
95 /bin/uname -r | /bin/grep "^2.6" 2>&1 > /dev/null
96 if [ $? = 0 ]; then
97 boot_mesg "Unmounting NFS Virtual Filesystem..."
98 /bin/umount /proc/fs/nfsd 2>&1 > /dev/null
99 evaluate_retval
100 fi
101
102 ;;
103
104 reload)
105 boot_mesg "Reloading NFS Server..."
106 /usr/sbin/exportfs -ra
107 evaluate_retval
108 ;;
109
110 restart)
111 $0 stop
112 sleep 1
113 $0 start
114 ;;
115
116 status)
117 statusproc /usr/sbin/rpc.mountd
118 ## Special case for nfsd with no full path
119 if [ "$NFS4" = "yes" ]; then
120 statusproc /usr/sbin/rpc.idmapd
121 statusproc /usr/sbin/rpc.svcgssd
122 fi
123 statusproc nfsd
124 statusproc /usr/sbin/rpc.statd
125 if [ "$QUOTA" = "yes" ]; then
126 statusproc rpc.rquotad
127 fi
128 ;;
129
130 *)
131 echo "Usage: $0 {start|stop|reload|restart|status}"
132 exit 1
133 ;;
134esac
135
136# End $rc_base/init.d/nfs-server
Note: See TracBrowser for help on using the repository browser.