#!/bin/sh # # chkconfig: 345 60 20 # description: Starts the AFS client daemon ### BEGIN INIT INFO # Provides: openafs # Required-Start: $network # Required-Stop: $network # Should-Start: dkms # Default-Start: 345 # Short-Description: Starts the AFS client daemon # Description: This startup script starts the AFS client daemon ### END INIT INFO # Source function library . /etc/rc.d/init.d/functions # Source networking configuration . /etc/sysconfig/network # Source specific configuration if available CACHESIZE=262144 MOUNTDIR=/afs if [ -r /etc/sysconfig/openafs ] ; then . /etc/sysconfig/openafs fi # Check that networking is up, unless dynroot is activated [ ${NETWORKING} = "no" -a $DYNROOT != "yes" ] && exit 0 NAME="AFS client daemon" LOCKFILE=/var/lock/subsys/openafs start() { rc=0 if [ ! -f $LOCKFILE ]; then gprintf "Starting %s: " "$NAME" # generate cache info echo $MOUNTDIR:/var/cache/openafs:$CACHESIZE > /etc/openafs/cacheinfo # compute options OPTIONS="-mountdir $MOUNTDIR" if [ $DYNROOT = "yes" ]; then OPTIONS="$OPTIONS -dynroot" fi if [ $AUTO_OPTIONS = "yes" ]; then if [ $CACHESIZE -lt 131072 ]; then OPTIONS="$OPTIONS -stat 300 -dcache 100 -daemons 2 -volumes 50" elif [ $CACHESIZE -lt 524288 ]; then OPTIONS="$OPTIONS -stat 2000 -dcache 800 -daemons 3 -volumes 70" elif [ $CACHESIZE -lt 1048576 ]; then OPTIONS="$OPTIONS -stat 2800 -dcache 2400 -daemons 5 -volumes 128" elif [ $CACHESIZE -lt 2097152 ]; then OPTIONS="$OPTIONS -stat 3600 -dcache 3600 -daemons 5 -volumes 196 -files 50000" else OPTIONS="$OPTIONS -stat 4000 -dcache 4000 -daemons 6 -volumes 256 -files 50000" fi fi if [ -n $MORE_OPTIONS ]; then OPTIONS="$OPTIONS $MORE_OPTIONS" fi # load kernel module modprobe libafs # start daemon daemon "afsd $OPTIONS >/dev/null 2>&1" rc=$? echo [ $rc -eq 0 ] && touch $LOCKFILE fi return $rc } stop() { gprintf "Stopping %s: " "$NAME" # unmount file system umount $MOUNTDIR rc=$? if [ $rc -eq 0 ]; then success echo else failure echo return $rc fi # unload kernel module rmmod libafs rm -f $LOCKFILE return $rc } restart() { stop start } case $1 in start) start ;; stop) stop ;; restart) restart ;; condrestart) if [ -f $LOCKFILE ]; then restart fi ;; status) status afsd ;; *) gprintf "Usage: %s {start|stop|restart|condrestart|status}\n" "$0" exit 1 ;; esac exit $?