2 # Copyright 2000, International Business Machines Corporation and others.
5 # This software has been released under the terms of the IBM Public
6 # License. For details, see the LICENSE file in the top-level source
7 # directory or online at http://www.openafs.org/dl/license10.html
9 # afs.rc: rc script for AFS on SGI Irix platforms
11 # Install this script as /etc/init.d/afs
12 # then make links like this:
13 # ln -s ../init.d/afs /etc/rc0.d/K35afs
14 # ln -s ../init.d/afs /etc/rc2.d/S35afs
16 # Config Files (in /etc/config)
17 # afsclient - machine should be an AFS client
18 # afsserver - machine should be an AFS server
19 # afsxnfs - machine should be an AFS/NFS translator (must also be
21 # afsml - dynamically load afs (using ml(1M))
23 # Option files (in /etc/config)
24 # afsd.options - options to pass to afsd. If present it overrides
27 # The following are 'recommended' values for various sized machines.
28 # These options should be given in /etc/config/afsd.options.
29 # If afsd.options does not exist then $OPTIONS is used.
32 # EXTRAOPTS can be used to enable/disable AFSDB support (-afsdb)
33 # and Dynroot (dynamically-generated /afs) support (-dynroot).
36 LARGE
="-stat 2800 -dcache 2400 -daemons 5 -volumes 128"
37 MEDIUM
="-stat 2000 -dcache 800 -daemons 3 -volumes 70"
38 SMALL
="-stat 300 -dcache 100 -daemons 2 -volumes 50"
39 OPTIONS
="$MEDIUM $EXTRAOPTS"
43 AFSDOPT
=$CONFIG/afsd.options
47 # The verbose flag controls the printing of the names of daemons as they
50 if $IS_ON verbose
; then
53 else # For a quiet startup and shutdown
59 # Run afsd in -nosettime mode if we have an alternative time sync
60 # OR we are a server and a client machine
62 if $IS_ON timed ||
$IS_ON timeslave || \
63 ( $IS_ON afsserver
&& $IS_ON afsclient
) ; then
69 # The network startup script (/etc/init.d/network) used to run
70 # "/etc/init.d/afs netstart" to accomodate the loading of AFS 3.3
71 # at a particular time relative to NFS. In AFS 3.4, we need to
72 # start up after the network script has completed, so the 'netstart'
73 # option is now a no-op and the 'start' option loads AFS.
80 # Figure out what kind of machine we're on.
84 if echo $OS_VERS | fgrep
6.4 > /dev
/null
87 elif echo $CPU | fgrep R3000
>/dev
/null
90 elif echo $CPU |
egrep 'R4000|R4400|4600' >/dev
/null
92 # R4xxx series can be either 32 or 64 bit kernels.
93 # Based on OS and CPUBOARD
95 if echo $OS_VERS | fgrep
6.2 > /dev
/null
98 if echo $IP_TYPE |
egrep '17|20|22' > /dev
/null
103 elif echo $CPU |
egrep R5000
>/dev
/null
105 # For 6.3, we have an R5000 library.
106 if echo $OS_VERS | fgrep
6.3 > /dev
/null
112 elif echo $CPU |
egrep R8000
>/dev
/null
115 elif echo $CPU |
egrep R10000
>/dev
/null
119 echo "Cannot determine system type: $CPU not understood"
120 echo "Aborting AFS start"
125 # Figure out if the machine is a multiprocessor or uniprocessor
128 if [ $COMMON_CLIENT = 1 ]
131 # Figure out if we need the .nonfs library
133 if [ -r /etc
/havenfs
-a /etc
/havenfs
];
137 NAME
="libafs.nonfs.o"
140 ARCH
=`hinv | awk '/Processor/ && /MHZ/ {print $1}'`
141 if test `echo $ARCH | wc -w` -gt 1
144 elif test $ARCH -eq 1
147 elif test $ARCH -gt 1
151 echo "Cannot determine if system is MP or SP"
152 echo "Aborting AFS start"
157 # Figure out if we need the .nonfs library
159 if [ -r /etc
/havenfs
-a /etc
/havenfs
];
161 NAME
="libafs.${ARCH}.${CPU}.o"
163 NAME
="libafs.${ARCH}.${CPU}.nonfs.o"
166 # End of COMMON_CLIENT
168 if [ -r /usr
/afs
/bin
/sgiload
/$NAME ]
170 MOD
=/usr
/afs
/bin
/sgiload
/$NAME
171 elif [ -r /usr
/vice
/etc
/sgiload
/$NAME ]
173 MOD
=/usr
/vice
/etc
/sgiload
/$NAME
175 echo "Cannot find afs kernel library: $NAME"
176 echo "Aborting AFS start"
180 $ECHO "Loading AFS from $MOD...\c"
181 if ml ld
$VERBOSE -j $MOD -p Afs_
-a afs
185 echo "Dynamic load of AFS failed - Aborting AFS start"
189 $ECHO "Not loading AFS kernel extensions - afsml config option is off"
192 if $IS_ON afsserver
&& test -x /usr
/afs
/bin
/bosserver
194 $ECHO "Starting AFS bosserver"
195 /usr
/afs
/bin
/bosserver
>/dev
/console
2>&1
198 if $IS_ON afsclient
&& test -x /usr
/vice
/etc
/afsd
; then
199 if test -s /usr
/vice
/etc
/ThisCell
; then
200 MYCELL
=`cat /usr/vice/etc/ThisCell`
202 echo "/usr/vice/etc/ThisCell not valid - Aborting AFS start"
205 if test -r $AFSDOPT ; then
206 OPTIONS
=`cat $AFSDOPT`
208 if $IS_ON afsxnfs
; then
209 OPTIONS
="$OPTIONS -rmtsys"
211 /usr
/vice
/etc
/afsd
$TIMESYNC $OPTIONS >/dev
/console
2>&1
213 # Let AFS think for a while
215 while test ! -x $AFSMT/$MYCELL -a $i -gt 0 ; do
219 if test ! -x $AFSMT/$MYCELL ; then
220 echo "Warning AFS initialization did not complete correctly"
223 # now that /afs is mounted - start up alternate inetd
224 AFSWS
=$AFSMT/$MYCELL/@sys
/usr
/afsws
225 if test -x $AFSWS/etc
/inetd.afs
-a -r $AFSWS/etc
/inetd.conf
; then
226 $ECHO "Starting AFS inetd"
227 $AFSWS/etc
/inetd.afs
$AFSWS/etc
/inetd.conf
2>/dev
/null
</dev
/null
&
235 # Stop the AFS inetd and server processes
236 # Note that the afsd processes cannot be killed
238 if $IS_ON afsclient
; then
242 if $IS_ON afsserver
&& test -x /usr
/afs
/bin
/bos
244 $ECHO "Stopping AFS bosserver"
245 /usr
/afs
/bin
/bos shutdown localhost
-localauth -wait
246 killall
-HUP bosserver
251 echo "usage: $0 {start|stop}"