Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / afsd / afs.rc.sgi_ipnos
1 #!/bin/sh
2 # Copyright 2000, International Business Machines Corporation and others.
3 # All Rights Reserved.
4 #
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
8
9 # afs.rc: rc script for AFS on SGI Irix platforms
10 #
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
15 #
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
20 # an AFS client)
21 # afsml - dynamically load afs (using ml(1M))
22 #
23 # Option files (in /etc/config)
24 # afsd.options - options to pass to afsd. If present it overrides
25 # the defaults here.
26 #
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.
30 #
31 LARGE="-stat 2800 -dcache 2400 -daemons 5 -volumes 128"
32 MEDIUM="-stat 2000 -dcache 800 -daemons 3 -volumes 70"
33 SMALL="-stat 300 -dcache 100 -daemons 2 -volumes 50"
34 OPTIONS=$MEDIUM
35
36 CONFIG=/etc/config
37 IS_ON=/etc/chkconfig
38 AFSDOPT=$CONFIG/afsd.options
39 AFSMT=/afs
40 COMMON_CLIENT=0
41
42 # The verbose flag controls the printing of the names of daemons as they
43 # are started
44
45 if $IS_ON verbose ; then
46 ECHO=echo
47 VERBOSE=-v
48 else # For a quiet startup and shutdown
49 ECHO=:
50 VERBOSE=
51 fi
52
53 #
54 # Run afsd in -nosettime mode if we have an alternative time sync
55 # OR we are a server and a client machine
56 #
57 if $IS_ON timed || $IS_ON timeslave || \
58 ( $IS_ON afsserver && $IS_ON afsclient ) ; then
59 TIMESYNC=-nosettime
60 fi
61
62 case "$1" in
63 'netstart')
64 # The network startup script (/etc/init.d/network) still runs
65 # "/etc/init.d/afs netstart" to accomodate the loading of AFS 3.3
66 # at a particular time relative to NFS. Post AFS 3.3, we need to
67 # start up after the network script has completed, so the 'netstart'
68 # option is now a no-op and the 'start' option loads AFS.
69 # Note that this option could be used to start inetd.afs if we run
70 # into cases where other servers got ports we want.
71 ;;
72 'start')
73
74 if $IS_ON afsml
75 then
76 #
77 # Figure out what kind of machine we're on.
78 #
79 IPNO=`uname -m`
80 #
81 # Figure out if we need load the NFS translator
82 #
83 if $IS_ON afsxnfs && test -x /etc/havenfs && /etc/havenfs ;
84 then
85 NAME="libafs.${IPNO}.o"
86 else
87 NAME="libafs.${IPNO}.nonfs.o"
88 fi
89
90 if [ -r /usr/afs/bin/sgiload/$NAME ]
91 then
92 MOD=/usr/afs/bin/sgiload/$NAME
93 elif [ -r /usr/vice/etc/sgiload/$NAME ]
94 then
95 MOD=/usr/vice/etc/sgiload/$NAME
96 else
97 echo "Cannot find afs kernel library: $NAME"
98 echo "Aborting AFS start"
99 exit 1
100 fi
101
102 $ECHO "Loading AFS from $MOD...\c"
103 if ml ld $VERBOSE -j $MOD -p Afs_ -a afs
104 then
105 :
106 else
107 echo "Dynamic load of AFS failed - Aborting AFS start"
108 exit 1
109 fi
110 else
111 $ECHO "Not loading AFS kernel extensions - afsml config option is off"
112 fi
113
114 if $IS_ON afsserver && test -x /usr/afs/bin/bosserver
115 then
116 $ECHO "Starting AFS bosserver"
117 /usr/afs/bin/bosserver >/dev/console 2>&1
118 fi
119
120 if $IS_ON afsclient && test -x /usr/vice/etc/afsd ; then
121 if test -s /usr/vice/etc/ThisCell ; then
122 MYCELL=`cat /usr/vice/etc/ThisCell`
123 else
124 echo "/usr/vice/etc/ThisCell not valid - Aborting AFS start"
125 exit 1
126 fi
127 if test -r $AFSDOPT ; then
128 OPTIONS=`cat $AFSDOPT`
129 fi
130 if $IS_ON afsxnfs ; then
131 OPTIONS="$OPTIONS -rmtsys"
132 fi
133 /usr/vice/etc/afsd $TIMESYNC $OPTIONS >/dev/console 2>&1
134
135 # Let AFS think for a while
136 i=30
137 while test ! -x $AFSMT/$MYCELL -a $i -gt 0 ; do
138 sleep 1
139 i=`expr $i - 1`
140 done
141 if test ! -x $AFSMT/$MYCELL ; then
142 echo "Warning AFS initialization did not complete correctly"
143 fi
144
145 # now that /afs is mounted - start up alternate inetd
146 AFSWS=$AFSMT/$MYCELL/@sys/usr/afsws
147 if test -x $AFSWS/etc/inetd.afs -a -r $AFSWS/etc/inetd.conf ; then
148 $ECHO "Starting AFS inetd"
149 $AFSWS/etc/inetd.afs $AFSWS/etc/inetd.conf 2>/dev/null </dev/null&
150 fi
151 fi
152
153 ;;
154
155 'stop')
156 #
157 # Stop the AFS inetd and server processes
158 # Note that the afsd processes cannot be killed
159 #
160 if $IS_ON afsclient ; then
161 killall inetd.afs
162 fi
163
164 if $IS_ON afsserver && test -x /usr/afs/bin/bos
165 then
166 $ECHO "Stopping AFS bosserver"
167 /usr/afs/bin/bos shutdown localhost -localauth -wait
168 killall -HUP bosserver
169 fi
170 ;;
171
172 *)
173 echo "usage: $0 {start|stop}"
174 ;;
175 esac