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 OSF/1 platforms
10 # This script assumes that you have AFS built into the kernel.
11 # This script should run after DCE, but before any long running programs
12 # start which use authentication. That is because we will modify the
15 # Install this script as /sbin/init.d/afs.rc
16 # then make links like this:
17 # ln -s ../init.d/afs.rc /sbin/rc0.d/K66afs
18 # ln -s ../init.d/afs.rc /sbin/rc3.d/S67afs
20 CONFIG=/usr/vice/etc/config
21 AFSDOPT=$CONFIG/afsd.options
22 PACKAGE=$CONFIG/package.options
24 LARGE="-stat 2800 -dcache 2400 -daemons 5 -volumes 128"
25 MEDIUM="-stat 2000 -dcache 800 -daemons 3 -volumes 70"
26 SMALL="-stat 300 -dcache 100 -daemons 2 -volumes 50"
28 if [ -f $AFSDOPT ]; then
29 OPTIONS=`cat $AFSDOPT`
34 # Need the commands ps, awk, kill, sleep
35 PATH=${PATH}${PATH:+:}/sbin:/bin:/usr/bin
37 killproc() { # kill the named process(es)
39 pid=`ps -ef | awk "/$1/ && ! /awk/ {print $awkfield2}"`
40 [ "$pid" != "" ] && kill -KILL $pid
47 # Start the AFS server processes if a bosserver exists
50 if [ -x /usr/afs/bin/bosserver ]; then
51 echo "Starting AFS Server processes"
52 /usr/afs/bin/bosserver
53 OPTIONS="$OPTIONS -nosettime"
58 # Check that all of the client configuration files exist
61 for file in /usr/vice/etc/afsd /usr/vice/etc/cacheinfo \
62 /usr/vice/etc/ThisCell /usr/vice/etc/CellServDB
64 if [ ! -f ${file} ]; then
65 echo "${file} does not exist. Not starting AFS client."
71 # Check that the root directory for AFS (/afs)
72 # and the cache directory (/usr/vice/cache) both exist
75 for dir in `awk -F: '{print $1, $2}' /usr/vice/etc/cacheinfo`
77 if [ ! -d ${dir} ]; then
78 echo "${dir} does not exist. Not starting AFS client."
84 /usr/vice/etc/afsd $OPTIONS
87 # Run package to update the disk
89 if [ -f /usr/afsws/etc/package -a -f $PACKAGE ]; then
90 /usr/afsws/etc/package -v -o `cat $PACKAGE` > /dev/console 2>&1
93 (echo "Package completed successfully") > /dev/console 2>&1
94 date > /dev/console 2>&1
97 (echo "Rebooting to restart system") > /dev/console 2>&1
102 (echo "Package update failed; continuing") > /dev/console 2>&1
109 # Start AFS inetd services
110 # (See the AFS Command Ref. for notes on the proper configuration of inetd.afs)
112 if [ -f /usr/sbin/inetd.afs -a -f /etc/inetd.conf.afs ]; then
113 /usr/sbin/inetd.afs /etc/inetd.conf.afs
116 # Let AFS get started, then test for the mount.
118 while test $i -gt 0; do
119 if mount | fgrep AFS > /dev/null
128 if [ $i -eq 0 ]; then
129 echo "AFS failed to start. Not setting AFS SIA mechanism."
134 # Update SIA matrix if /usr/shlib/libafssiad.so is present.
135 # Note that this runs *after* DCE so that we're sure to be after DCE in
138 if [ -f /usr/shlib/libafssiad.so ]; then
139 if [ -f /etc/sia/matrix.conf ]; then
140 echo Setting SIA matrix
141 sed -e 's:(AFS,/usr/shlib/libafssiad.so)[^(]*::g; s:,$::; s:(BSD,libc.so):(AFS,/usr/shlib/libafssiad.so),&:; s:(OSFC2,libsecurity.so):(AFS,/usr/shlib/libafssiad.so),&:' /etc/sia/matrix.conf > /etc/sia/AFS_matrix.conf
142 mv /etc/sia/matrix.conf /etc/sia/AFS_matrix.conf.orig
143 ln -s AFS_matrix.conf /etc/sia/matrix.conf
145 echo No matrix.conf file, not setting AFS SIA mechanism.
148 echo No /usr/shlib/libafssiad.so library, not setting AFS SIA mechanism.
156 # Stop the AFS inetd and server processes
157 # Note that the afsd processes cannot be killed
158 # Digital Unix 4.0 will reset the matrix.conf upon reboot to bsd_matrix.conf
160 echo "Killing inetd.afs"
163 bosrunning=`ps -ef | awk '/bosserver/ && ! /awk/'`
164 if [ "${bosrunning}" != "" ]; then
165 echo "Shutting down AFS server processes"
166 /usr/afs/bin/bos shutdown localhost -localauth -wait
167 echo "Killing AFS bosserver"
173 *) echo "Invalid option supplied to $0"