3 # afs.rc: rc script for AFS on Solaris 2.x platforms
5 # Install this script as /etc/init.d/afs.rc
6 # then make links like this:
7 # ln -s ../init.d/afs.rc /etc/rc0.d/K66afs
8 # ln -s ../init.d/afs.rc /etc/rc3.d/S99afs
10 CONFIG
=/usr
/vice
/etc
/config
11 AFSDOPT
=$CONFIG/afsd.options
12 PACKAGE
=$CONFIG/package.options
14 # EXTRAOPTS can be used to enable/disable AFSDB support (-afsdb)
15 # and Dynroot (dynamically-generated /afs) support (-dynroot).
18 LARGE
="-stat 2800 -dcache 2400 -daemons 5 -volumes 128"
19 MEDIUM
="-stat 2000 -dcache 800 -daemons 3 -volumes 70"
20 SMALL
="-stat 300 -dcache 100 -daemons 2 -volumes 50"
22 if [ -f $AFSDOPT ]; then
23 OPTIONS
=`cat $AFSDOPT`
25 OPTIONS
="$MEDIUM $EXTRAOPTS"
28 # Need the commands ps, awk, kill, sleep
29 PATH
=${PATH}${PATH:+:}/sbin
:/bin
:/usr
/bin
31 killproc
() { # kill the named process(es)
33 pid
=`ps -ef | awk "/$1/ && ! /awk/ {print $awkfield2}"`
34 [ "$pid" != "" ] && kill -KILL $pid
41 # Make sure afs exists in /etc/name_to_sysnum
43 if grep -s "afs" /etc
/name_to_sysnum
> /dev
/null
; then
44 echo "Entry for afs already exists in /etc/name_to_sysnum"
46 echo "Creating entry for afs in /etc/name_to_sysnum"
47 cp /etc
/name_to_sysnum
/etc
/name_to_sysnum.orig
49 afs 65' /etc
/name_to_sysnum
> /tmp
/name_to_sysnum
50 mv /tmp
/name_to_sysnum
/etc
/name_to_sysnum
51 echo "Rebooting now for new /etc/name_to_sysnum to take effect"
55 ## Check to see that /bin/isalist exists and is executable
56 if [ ! -x /bin
/isalist
] ;then
57 echo "/bin/isalist not executable"
61 ## Determine if we are running the 64 bit OS
62 ## If sparcv9 then the location of the afs and nfs extensions differ
64 case `/bin/isalist` in
66 nfssrv
=/kernel
/misc
/sparcv
9/nfssrv
67 afs
=/kernel
/fs
/sparcv
9/afs
;;
69 nfssrv
=/kernel
/misc
/nfssrv
75 # Load kernel extensions
77 # nfssrv has to be loaded first
80 if [ -f $nfssrv ]; then
81 echo "Loading NFS server kernel extensions"
84 echo "$nfssrv does not exist. Skipping AFS startup."
88 ## Load AFS kernel extensions
91 echo "Loading AFS kernel extensions"
94 echo "$afs does not exist. Skipping AFS startup."
99 # Start the AFS server processes if a bosserver exists
102 if [ -x /usr
/afs
/bin
/bosserver
]; then
103 echo "Starting AFS Server processes"
104 /usr
/afs
/bin
/bosserver
&
105 OPTIONS
="$OPTIONS -nosettime"
110 # Check that all of the client configuration files exist
113 for file in /usr
/vice
/etc
/afsd
/usr
/vice
/etc
/cacheinfo \
114 /usr
/vice
/etc
/ThisCell
/usr
/vice
/etc
/CellServDB
116 if [ ! -f ${file} ]; then
117 echo "${file} does not exist. Not starting AFS client."
123 # Check that the root directory for AFS (/afs)
124 # and the cache directory (/usr/vice/cache) both exist
127 for dir
in `awk -F: '{print $1, $2}' /usr/vice/etc/cacheinfo`
129 if [ ! -d ${dir} ]; then
130 echo "${dir} does not exist. Not starting AFS client."
136 /usr
/vice
/etc
/afsd
$OPTIONS
139 # Run package to update the disk
141 if [ -f /usr
/afsws
/etc
/package
-a -f $PACKAGE ]; then
142 /usr
/afsws
/etc
/package
-v -o `cat $PACKAGE` > /dev
/console
2>&1
145 (echo "Package completed successfully") > /dev
/console
2>&1
146 date > /dev
/console
2>&1
149 (echo "Rebooting to restart system") > /dev
/console
2>&1
154 (echo "Package update failed; continuing") > /dev
/console
2>&1
161 # Start AFS inetd services
162 # (See the AFS Command Ref. for notes on the proper configuration of inetd.afs)
164 if [ -f /usr
/sbin
/inetd.afs
-a -f /etc
/inetd.conf.afs
]; then
165 /usr
/sbin
/inetd.afs
/etc
/inetd.conf.afs
173 # Stop the AFS inetd and server processes
174 # Note that the afsd processes cannot be killed
177 echo "Killing inetd.afs"
180 bosrunning
=`ps -ef | awk '/bosserver/ && ! /awk/'`
181 if [ "${bosrunning}" != "" ]; then
182 echo "Shutting down AFS server processes"
183 /usr
/afs
/bin
/bos shutdown localhost
-localauth -wait
184 echo "Killing AFS bosserver"
190 *) echo "Invalid option supplied to $0"