3 # Copyright 2000, International Business Machines Corporation and others.
6 # This software has been released under the terms of the IBM Public
7 # License. For details, see the LICENSE file in the top-level source
8 # directory or online at http://www.openafs.org/dl/license10.html
10 # afs.rc: rc script for AFS on Solaris 2.x platforms
12 # Install this script as /etc/init.d/afs.rc
13 # then make links like this:
14 # ln -s ../init.d/afs.rc /etc/rc0.d/K66afs
15 # ln -s ../init.d/afs.rc /etc/rc3.d/S99afs
17 CONFIG=/usr/vice/etc/config
18 AFSDOPT=$CONFIG/afsd.options
19 PACKAGE=$CONFIG/package.options
21 # EXTRAOPTS can be used to enable/disable AFSDB support (-afsdb)
22 # and Dynroot (dynamically-generated /afs) support (-dynroot).
25 LARGE="-stat 2800 -dcache 2400 -daemons 5 -volumes 128"
26 MEDIUM="-stat 2000 -dcache 800 -daemons 3 -volumes 70"
27 SMALL="-stat 300 -dcache 100 -daemons 2 -volumes 50"
29 if [ -f $AFSDOPT ]; then
30 OPTIONS=`cat $AFSDOPT`
32 OPTIONS="$MEDIUM $EXTRAOPTS"
35 # Need the commands ps, awk, kill, sleep
36 PATH=${PATH}${PATH:+:}/sbin:/bin:/usr/bin
38 killproc() { # kill the named process(es)
40 pid=`ps -ef | awk "/$1/ && ! /awk/ {print $awkfield2}"`
41 [ "$pid" != "" ] && kill -KILL $pid
48 # Make sure afs exists in /etc/name_to_sysnum
50 if grep -s "afs" /etc/name_to_sysnum > /dev/null; then
51 echo "Entry for afs already exists in /etc/name_to_sysnum"
53 echo "Creating entry for afs in /etc/name_to_sysnum"
54 cp /etc/name_to_sysnum /etc/name_to_sysnum.orig
56 afs 73' /etc/name_to_sysnum > /tmp/name_to_sysnum
57 mv /tmp/name_to_sysnum /etc/name_to_sysnum
58 echo "Rebooting now for new /etc/name_to_sysnum to take effect"
62 ## Check to see that /bin/isalist exists and is executable
63 if [ ! -x /bin/isalist ] ;then
64 echo "/bin/isalist not executable"
68 ## Determine if we are running the 64 bit OS
69 ## If sparcv9 then the location of the afs and nfs extensions differ
71 case `/bin/isalist` in
73 nfssrv=/kernel/misc/sparcv9/nfssrv
74 afs=/kernel/fs/sparcv9/afs ;;
76 nfssrv=/kernel/misc/nfssrv
82 # Load kernel extensions
84 # nfssrv has to be loaded first
87 if [ -f $nfssrv ]; then
88 echo "Loading NFS server kernel extensions"
91 echo "$nfssrv does not exist. Skipping AFS startup."
95 ## Load AFS kernel extensions
98 echo "Loading AFS kernel extensions"
101 echo "$afs does not exist. Skipping AFS startup."
106 # Start the AFS server processes if a bosserver exists
109 if [ -x /usr/afs/bin/bosserver ]; then
110 echo "Starting AFS Server processes"
111 /usr/afs/bin/bosserver &
112 OPTIONS="$OPTIONS -nosettime"
117 # Check that all of the client configuration files exist
120 for file in /usr/vice/etc/afsd /usr/vice/etc/cacheinfo \
121 /usr/vice/etc/ThisCell /usr/vice/etc/CellServDB
123 if [ ! -f ${file} ]; then
124 echo "${file} does not exist. Not starting AFS client."
130 # Check that the root directory for AFS (/afs)
131 # and the cache directory (/usr/vice/cache) both exist
134 for dir in `awk -F: '{print $1, $2}' /usr/vice/etc/cacheinfo`
136 if [ ! -d ${dir} ]; then
137 echo "${dir} does not exist. Not starting AFS client."
143 /usr/vice/etc/afsd $OPTIONS
146 # Run package to update the disk
148 if [ -f /usr/afsws/etc/package -a -f $PACKAGE ]; then
149 /usr/afsws/etc/package -v -o `cat $PACKAGE` > /dev/console 2>&1
152 (echo "Package completed successfully") > /dev/console 2>&1
153 date > /dev/console 2>&1
156 (echo "Rebooting to restart system") > /dev/console 2>&1
161 (echo "Package update failed; continuing") > /dev/console 2>&1
168 # Start AFS inetd services
169 # (See the AFS Command Ref. for notes on the proper configuration of inetd.afs)
171 if [ -f /usr/sbin/inetd.afs -a -f /etc/inetd.conf.afs ]; then
172 /usr/sbin/inetd.afs /etc/inetd.conf.afs
180 # Stop the AFS inetd and server processes
181 # Note that the afsd processes cannot be killed
184 echo "Killing inetd.afs"
187 bosrunning=`ps -ef | awk '/bosserver/ && ! /awk/'`
188 if [ "${bosrunning}" != "" ]; then
189 echo "Shutting down AFS server processes"
190 /usr/afs/bin/bos shutdown localhost -localauth -wait
191 echo "Killing AFS bosserver"
197 *) echo "Invalid option supplied to $0"