thanks, SysV init script

Sergio Ballestrero sergio.ballestrero at cern.ch
Fri Dec 10 21:11:25 CET 1999


  Hello drinkers :-),

 as a newcomer to Arla, i am saying thanks to all the Arla developers, for
they helped me staying away from the always outdated Transarc client :-D

 Well, on a more practical side, i have attached a LinuxConf/RedHat
"compatible" or "enhanced" SysV init script, derived from the distribution
one. It has been simplified, because linuxconf takes care of at least some
of the checks. The ".init"  extension is gone, because so it has to be,
after the "enhanced SysV" specs. The comments at the start contain the
requested fields so that the handling by Linuxconf is mostly automatic -
i've chosen to use the same levels and priorities as the nfsd. It
is specific to my setup, using /opt/arla, but that should not be a
problem... 
 So, let me know if you like it. or not.
 
 Cheers,
   Sergio

PS the "enhanced SysV" documentation is available from
http://www.solucorp.qc.ca/linuxconf, in the technical section

--------------------------------------------------------------------------
 Things will get better despite             Sergio Ballestrero
our efforts to improve them.                  Sergio.Ballestrero at cern.ch
	-- Will Rogers                             S.Ballestrero at iname.com


#!/bin/sh
#
# $Id: arla.init.in,v 1.3 1999/08/14 02:54:34 lha Exp $
#
# A simple SYSV startup script to start/stop arla for Linux
# 
# You must have a path that includes, insmod, mknod, 
# chmod, mount, mkdir and arlad.
#
# chkconfig: 345 60 20
# description: Arla is a client for Transarc \
#              AFS.  It is used to access AFS \
#              network file system servers.
# processname: arlad
# pidfile: /var/run/arlad.pid
# config: /opt/arla/etc/arla.conf
# config: /opt/arla/etc/ThisCell
# config: /opt/arla/etc/SuidCell


PATH="/sbin:/usr/sbin:/usr/bin:/bin:/opt/arla/bin"
ARLABINDIR=/opt/arla/bin
CACHEDIR=/opt/arla/cache
export PATH

run_program() {
    if $*; then
        :
    else
	echo "failed"
	exit 1
    fi
}

# Source function library.
. /etc/rc.d/init.d/functions


if [ ! -f $ARLABINDIR/xfs.o -o ! -x $ARLABINDIR/arlad ]; then
    echo "Arla not correctly installed"
    exit 1
fi
if [ ! -c /dev/xfs0 ] ; then
   echo Creating device /dev/xfs0
   rm -f /dev/xfs0
   mknod /dev/xfs0 c 103 0
   chmod 600 /dev/xfs0
fi
if [ ! -e $CACHEDIR ] ; then
   echo Creating cache directory $CACHEDIR
   mkdir -p $CACHEDIR
   chmod 700 $CACHEDIR
   chown root $CACHEDIR
fi

if [ ! -e /afs ] ; then
   echo Creating mount directory /afs
   mkdir -p /afs
   chmod 700 /afs
   chown root /afs
fi

case "$1" in
    start)
	action "Loading xfs kernel module: " insmod $ARLABINDIR/xfs.o
	sleep 1
	echo -n "Starting arlad: "
	daemon $ARLABINDIR/arlad -z	
	RETVAL=$?
	echo
	sleep 3
	action "Mounting AFS filesystem: " mount -t xfs arla /afs
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/arla
	;;
    stop)
        if [ -n "$(mount|grep 'type xfs')" ] ; then
	   action "Unmounting AFS filesystem: " umount -a -f -t xfs || exit 1
	fi
	echo -n "Stopping arlad... "
	killproc arlad
	RETVAL=$?
	echo
	sleep 3
	action "Unloading xfs kernel module: " rmmod xfs
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/arla
	;;
    restart)
	$0 stop
	$0 start
        ;;
    status)
	echo "Mounted AFS file systems:"
	mount|grep 'type xfs'
        status arlad
	if [ -n "$(lsmod|grep xfs)" ] ; then
	   echo xfs kernel module loaded
	else
	   echo xfs kernel module not loaded
	fi
	;;
    *)
        echo "Usage: $0 {start|stop|restart|status}"
        exit 1
	;;
esac






More information about the Arla-drinkers mailing list