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 # Portions Copyright (c) 2003 Apple Computer, Inc.
11 # Updated to match standard service scripts
12 # Phil Holland <hollandp@umich.edu> 6/11/04
17 # Variable Definition Section
23 if [ -r /var/db/openafs ]; then
24 VICEETC=/var/db/openafs/etc
28 CONFIG=$VICEETC/config
29 AFSDOPT=$CONFIG/afsd.options
30 PACKAGE=$CONFIG/package.options
32 LARGE="-stat 2800 -dcache 2400 -daemons 5 -volumes 128"
33 MEDIUM="-stat 2000 -dcache 800 -daemons 3 -volumes 70"
34 SMALL="-stat 300 -dcache 100 -daemons 2 -volumes 50"
36 if [ -x /usr/sbin/kextstat ]; then KMODSTAT=/usr/sbin/kextstat; fi
37 if [ -x /usr/sbin/kmodstat ]; then KMODSTAT=/usr/sbin/kmodstat; fi
39 if [ -f $CONFIG/afs.conf ]; then
43 # Check this file second so that if users have altered the file, it will
44 # override the default options
45 if [ -f $AFSDOPT ]; then
46 OPTIONS=`cat $AFSDOPT`
51 echo "Starting OpenAFS"
53 if [ -z "$OPTIONS" ] || [ "$OPTIONS" = "AUTOMATIC" ] ; then
54 AFSD_OPTIONS="$VERBOSE"
56 AFSD_OPTIONS="$OPTIONS $VERBOSE"
59 if [ "${NETWORKUP}" = "-NO-" ]; then
60 echo $AFSD_OPTIONS | grep -e '-dynroot' || exit
63 # Need the commands ps, awk, kill, sleep
64 PATH=${PATH}${PATH:+:}/sbin:/bin:/usr/bin
66 if [ -d $VICEETC/afs.kext ]; then
67 echo "Loading AFS kernel extensions"
68 kextload $VICEETC/afs.kext
70 echo "$VICEETC/afs.kext does not exist. Skipping AFS startup."
74 if $KMODSTAT | perl -e 'exit not grep /openafs/, <>' ; then
77 echo "AFS kernel extensions failed to initialize. Skipping AFS startup."
82 # Start the AFS server processes if a bosserver exists
85 if [ -x /usr/afs/bin/bosserver ]; then
86 echo "Starting AFS Server processes"
87 /usr/afs/bin/bosserver
88 AFSD_OPTIONS="$AFSD_OPTIONS -nosettime"
93 # Check that all of the client configuration files exist
96 for file in $AFSD $VICEETC/cacheinfo \
97 $VICEETC/ThisCell $VICEETC/CellServDB
99 if [ ! -f ${file} ]; then
100 echo "${file} does not exist. Not starting AFS client."
106 # Check that the root directory for AFS (/afs)
107 # and the cache directory (/usr/vice/cache) both exist
110 for dir in `awk -F: '{print $1, $2}' $VICEETC/cacheinfo`
112 if [ ! -d ${dir} ]; then
113 echo "${dir} does not exist. Not starting AFS client."
122 # From /var/db/openafs/etc/config/afs.conf, call a post-init function or
123 # command if it's been defined
128 # Call afssettings (if it exists) to set customizable parameters
130 if [ -x $CONFIG/afssettings ]; then
136 # From /var/db/openafs/etc/config/afs.conf, set a sysname list if one was
139 if [ -n "$AFS_SYSNAME" ] ; then
140 fs sysname $AFS_SYSNAME
143 if [ -n "$AFS_PRECACHE" ] ; then
144 fs precache $AFS_PRECACHE
148 # Run package to update the disk
150 if [ -f /usr/afsws/etc/package -a -f $PACKAGE ]; then
151 /usr/afsws/etc/package -v -o `cat $PACKAGE` > /dev/console 2>&1
154 (echo "Package completed successfully") > /dev/console 2>&1
155 date > /dev/console 2>&1
158 (echo "Rebooting to restart system") > /dev/console 2>&1
163 (echo "Package update failed; continuing") > /dev/console 2>&1
169 # Start AFS inetd services
170 # (See the AFS Command Ref. for notes on the proper configuration of inetd.afs)
172 if [ -f /usr/sbin/inetd.afs -a -f /etc/inetd.conf.afs ]; then
173 /usr/sbin/inetd.afs /etc/inetd.conf.afs
182 # If a pre-shutdown function was defined in /var/db/openafs/etc/config/afs.conf
183 # was defined, then run it
187 if $KMODSTAT | perl -e 'exit not grep /openafs/, <>' ; then
188 echo "Unmounting /afs"
189 umount -f /afs 2>&1 > /dev/console
191 echo "Shutting down afsd processes"
192 $AFSD -shutdown 2>&1 > /dev/console
194 echo "Unloading AFS kernel extensions"
195 kextunload $VICEETC/afs.kext 2>&1 > /dev/console
205 RunService "${1:-start}"