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/rc2.d/S70afs
10 CONFIG=/usr/vice/etc/config
11 AFSDOPT=$CONFIG/afsd.options
12 PACKAGE=$CONFIG/package.options
14 LARGE="-stat 2800 -dcache 2400 -daemons 5 -volumes 128 -afsdb"
15 MEDIUM="-stat 2000 -dcache 800 -daemons 3 -volumes 70 -afsdb"
16 SMALL="-stat 300 -dcache 100 -daemons 2 -volumes 50 -afsdb"
18 if [ -f $AFSDOPT ]; then
19 OPTIONS=`cat $AFSDOPT`
24 # Need the commands ps, awk, kill, sleep
25 PATH=${PATH}${PATH:+:}/sbin:/bin:/usr/bin
27 killproc() { # kill the named process(es)
29 pid=`ps -ef | awk "/$1/ && ! /awk/ {print $awkfield2}"`
30 [ "$pid" != "" ] && kill -KILL $pid
37 # Make sure afs exists in /etc/name_to_sysnum
39 if grep -s "afs" /etc/name_to_sysnum > /dev/null; then
40 echo "Entry for afs already exists in /etc/name_to_sysnum"
42 echo "Creating entry for afs in /etc/name_to_sysnum"
43 cp /etc/name_to_sysnum /etc/name_to_sysnum.orig
45 afs 65' /etc/name_to_sysnum > /tmp/name_to_sysnum
46 mv /tmp/name_to_sysnum /etc/name_to_sysnum
47 echo "Rebooting now for new /etc/name_to_sysnum to take effect"
51 ## Check to see that /bin/isalist exists and is executable
52 if [ ! -x /bin/isalist ] ;then
53 echo "/bin/isalist not executable"
57 ## Determine if we are running the 64 bit OS
58 ## If sparcv9 then the location of the afs and nfs extensions differ
60 case `/bin/isalist` in
62 nfssrv=/kernel/misc/sparcv9/nfssrv
63 afs=/kernel/fs/sparcv9/afs ;;
65 nfssrv=/kernel/misc/nfssrv
71 # Load kernel extensions
73 # nfssrv has to be loaded first
76 if [ -f $nfssrv ]; then
77 echo "Loading NFS server kernel extensions"
80 echo "$nfssrv does not exist. Skipping AFS startup."
84 ## Load AFS kernel extensions
87 echo "Loading AFS kernel extensions"
90 echo "$afs does not exist. Skipping AFS startup."
95 # Start the AFS server processes if a bosserver exists
98 if [ -x /usr/afs/bin/bosserver ]; then
99 echo "Starting AFS Server processes"
100 /usr/afs/bin/bosserver &
101 OPTIONS="$OPTIONS -nosettime"
106 # Check that all of the client configuration files exist
109 for file in /usr/vice/etc/afsd /usr/vice/etc/cacheinfo \
110 /usr/vice/etc/ThisCell /usr/vice/etc/CellServDB
112 if [ ! -f ${file} ]; then
113 echo "${file} does not exist. Not starting AFS client."
119 # Check that the root directory for AFS (/afs)
120 # and the cache directory (/usr/vice/cache) both exist
123 for dir in `awk -F: '{print $1, $2}' /usr/vice/etc/cacheinfo`
125 if [ ! -d ${dir} ]; then
126 echo "${dir} does not exist. Not starting AFS client."
132 /usr/vice/etc/afsd $OPTIONS
135 # Run package to update the disk
137 if [ -f /usr/afsws/etc/package -a -f $PACKAGE ]; then
138 /usr/afsws/etc/package -v -o `cat $PACKAGE` > /dev/console 2>&1
141 (echo "Package completed successfully") > /dev/console 2>&1
142 date > /dev/console 2>&1
145 (echo "Rebooting to restart system") > /dev/console 2>&1
150 (echo "Package update failed; continuing") > /dev/console 2>&1
157 # Start AFS inetd services
158 # (See the AFS Command Ref. for notes on the proper configuration of inetd.afs)
160 if [ -f /usr/sbin/inetd.afs -a -f /etc/inetd.conf.afs ]; then
161 /usr/sbin/inetd.afs /etc/inetd.conf.afs
169 # Stop the AFS inetd and server processes
170 # Note that the afsd processes cannot be killed
173 echo "Killing inetd.afs"
176 bosrunning=`ps -ef | awk '/bosserver/ && ! /awk/'`
177 if [ "${bosrunning}" != "" ]; then
178 echo "Shutting down AFS server processes"
179 /usr/afs/bin/bos shutdown localhost -localauth -wait
180 echo "Killing AFS bosserver"
186 *) echo "Invalid option supplied to $0"