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 Start and stop AFS components
12 # chkconfig: 345 60 20
13 # description: AFS is a distributed file system which provides location
14 # transparency, caching and secure authentication.
15 # Additional configuration can be done in the /etc/sysconfig/afs
16 # file. Read the documentation in that file for more information.
18 # Note that AFS does not use a pid file in /var/run. It is turned off by
22 # Gather up options and post startup script name, if present
23 if [ -f /etc/sysconfig/afs ]; then
27 # is_on returns 1 if value of arg is "on"
29 if test "$1" = "on" ; then return 0
34 # If choose_client can't correctly determine which client to use, set
38 # Use the second field of the uname -v output instead of just
39 # doing a match on the whole thing to protect against matching
40 # a timezone named SMP -- I don't know of one, but let's be
43 set X `uname -v`; shift
45 SMP) MP=.mp ;; # MP system
49 # For now, just use uname -r to get the module version.
52 LIBAFS=libafs-$VERSION$MP.o
56 # Find prefix symbol to use with insmod. We find the unregister_filesystem
57 # string from /proc/ksyms since we know it's there. If /proc/ksyms does not
58 # exist, we print that info to the console and use the uname -v output to
60 # unregister_filesystem_Rsmp_b240cad8 is a typcial SMP version string from
61 # a kernel built from ftp.kernel.org
64 KSYMS_FILE=/proc/ksyms
65 SEARCH_STR="unregister_filesystem"
66 DEFAULT_SMP_PREFIX="smp_" # Redhat kernels need "smp" instead
67 PREFIX="" # none needed for UP with <= 1Gig memory
75 set X `fgrep $SEARCH_STR $KSYMS_FILE 2> /dev/null`; shift
82 # No versioning in kernel symbols
85 suffix=${str#${SEARCH_STR}_R}
91 echo afsd: Cannot find \"$SEARCH_STR\" in file $KSYMS_FILE
94 echo afsd: Malformed kernel version symbol \"$str\"
98 echo Guessing prefix from output of uname -v
99 set X `uname -v`; shift
102 PREFIX=$DEFAULT_SMP_PREFIX
110 MODLOADDIR=/usr/vice/etc/modload
111 # load_client loads the AFS client module if it's not already loaded.
113 # If LIBAFS is set, use it.
114 if [ -z "$LIBAFS" ] ; then
115 # Try to determine the right client.
119 if [ ! -f $MODLOADDIR/$LIBAFS ] ; then
120 echo AFS module $MODLOADDIR/$LIBAFS does not exist. Not starting AFS.
124 # use the prefix command if required
126 /sbin/insmod ${PREFIX:+-P $PREFIX} -f -m $MODLOADDIR/$LIBAFS > $MODLOADDIR/libafs.map 2>&1
131 # Load kernel extensions
132 if load_client ; then :
134 echo Failed to load AFS client, not starting AFS services.
138 echo "Starting AFS services..... "
139 # Start bosserver, it if exists
140 if is_on $AFS_SERVER && test -x /usr/afs/bin/bosserver ; then
141 /usr/afs/bin/bosserver
145 if is_on $AFS_CLIENT && test -x /usr/vice/etc/afsd ; then
146 /usr/vice/etc/afsd ${OPTIONS}
148 # Start AFS version of inetd.conf if present.
149 if test -f /usr/afsws/etc/inetd.conf -a -x /usr/afsws/etc/inetd.afs ; then
150 /usr/afsws/etc/inetd.afs /usr/afsws/etc/inetd.conf
159 echo "Stopping AFS services..... "
161 if is_on $AFS_CLIENT ; then
166 if is_on $AFS_SERVER && test -x /usr/afs/bin/bos ; then
167 echo "Stopping AFS bosserver"
168 /usr/afs/bin/bos shutdown localhost -localauth -wait
169 killall -HUP bosserver
172 LIBAFS=`/sbin/lsmod | fgrep libafs`
173 if [ -n "$LIBAFS" ] ; then
174 LIBAFS=`echo $LIBAFS | awk 'BEGIN { FS = " " } { print $1 }'`
181 echo Usage: 'afs <start|stop>'