[OpenAFS] Initial server setup

Martin Lütken mlu@danware.dk
Tue, 27 Mar 2007 17:34:20 +0200


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
ted wrote:
<blockquote cite="mid46031C58.1060102@yahoo.com" type="cite">
  <pre wrap="">Go with the config.sh I sent, it has namei on

do a make ;make install

look at the contents of /usr/vice and usr/afs before and after the make
install

cd /usr/vice;mkdir cache;cd etc;ls

insmod libafs-2.6.18.2-34-default-ted.ko #if it doesn't complain, the
kernel module compiled OK
If it does complain, probably the kernel you built the .ko for is not
the one your running... reboot into the correct kernel
or fix the compile -

cp libafs-2.6.18.2-34-default-ted.ko 
/lib/modules/2.6.18.2-34-default-ted/kernel/fs/afs/libafs.ko  #put the
.ko in the library tree
+;cd /lib/modules/2.6.18.2-34-default-ted/kernel;depmod;-
modprobe libafs  #should automatically insmod the libafs.ko
  </pre>
</blockquote>
Ok, after copy of libafs-2.6-xxx to /lib/modules/2.6-xx/../afs/libafs.ko<br>
and running "depmod" I can use "modprobe" to install "libafs" without
trouble.<br>
The "sunrpc" modules gets pulled in automatically. So far so good!<br>
<blockquote cite="mid46031C58.1060102@yahoo.com" type="cite">
  <pre wrap="">
#########I think that the client can be tested against any cell in the
standard CellServDB off the openafs website - it will obviously show
only unauthenticated files - play around

dyno:/usr/vice/etc # ls /afs
.:mount  .grand.central.org  .home.ted-doris.fam  grand.central.org 
home.ted-doris.fam

  </pre>
</blockquote>
I copied the "afs-client" script to /etc/init.d/ and created an
/etc/sysconfig/afs-client from the listing you provided. I also made
the aliases for starting and stopping the client and server.<br>
<br>
I have tried setting the variables for a couple of the cells from the
standard CellServDB and it seems to work fine, only a bit slow when
doing a 'ls'. I can copy files from the mounted afs dirs and only the
first time the copy takes time. After that it seems to be cached and
then it's a fast copy.<br>
<br>
I can't reach (or even nslookup) your nome.home.ted-doris.fam, but ,
since the other cells seems to work with my client I guess I got the
client working correctly.<br>
So thanks a lot so far :)<br>
<br>
I suppose I am ready for the Kerberos and server setup!<br>
Will try to read a little bit about Kerberos until I hear from you
again!<br>
<br>
-Martin L&uuml;tken<br>
<blockquote cite="mid46031C58.1060102@yahoo.com" type="cite">
  <pre wrap="">



My /usr/vice/etc  looks like this:
CellServDB  ThisCell  cacheinfo  libafs-2.6.18.2-34-default-ted.ko

cacheinfo is set up initially by /etc/sysconfig/afs-client but it can be
set manually:
/afs:/usr/vice/cache:800000
  </pre>
</blockquote>
<blockquote cite="mid46031C58.1060102@yahoo.com" type="cite">
  <pre wrap="">
CellServDB:
#Cell name, generated from /etc/sysconfig/afs-client
10.1.1.193 #nome.home.ted-doris.fam
  </pre>
  <blockquote type="cite">
    <pre wrap="">grand.central.org      # Grand Central Communications
    </pre>
  </blockquote>
  <pre wrap=""><!---->18.7.14.88                      #grand-opening.mit.edu
128.2.191.224                   #penn.central.org



#nome.home.ted-doris.fam must be resolvable either in /etc/hosts or via DNS
ThisCell:
home.ted-doris.fam

#note my domain is ted-doris.fam - this is covered in the krb5.conf file

put the following in your .bashrc and restart your xterm:

alias starts='/etc/init.d/afs-server start'
alias startc='/etc/init.d/afs-client start'
alias stopc='/etc/init.d/afs-client stop'
alias stops='/etc/init.d/afs-server stop'
alias startkdc='/etc/init.d/krb5kdc start;/etc/init.d/krb524d
start;/etc/init.d/kadmind start'
alias stopkdc='/etc/init.d/krb5kdc stop;/etc/init.d/krb524d
stop;/etc/init.d/kadmind stop'

past the following into /etc/sysconfig/afs-client:

#####################################################################
## Path:        Network/File systems/AFS client
## Description: AFS client configuration
## Type:        yesno
## Default:     no
#
# Set to "yes" if you want to generate CellServDB and ThisCell files
# from THIS_CELL and THIS_CELL_SERVER variables.
# If you want more complicated setting, set REGENERATE_CELL_INFO to "no"
# and edit the files manually.
#
REGENERATE_CELL_INFO="no"  ###initially yes

## Type:        string
## Default:     ""
#
# This cell name
#
THIS_CELL="home.ted-doris.fam"

## Type:        string
## Default:     ""
#
# IP address of afs server for this cell
#
THIS_CELL_SERVER="10.1.1.193"

## Type:        string
## Default:     ""
#
# DNS name of afs server for this cell
#
THIS_CELL_SERVER_NAME="nome.home.ted-doris.fam"

## Type:        yesno
## Default:     yes
#
# Set to "yes" if you want to use data encription (secure, slower)
#
DATA_ENCRYPTION="no"

## Type:        yesno
## Default:     yes
#
# Set to "yes" if you want to generate cacheinfo file
#
REGENERATE_CACHE_INFO="no" ###initially yes

## Type:        string
## Default:     ""
#
# AFS client configuration options
#
XXLARGE="-stat 4000 -dcache 4000 -daemons 6 -volumes 256 -files 50000"
XLARGE="-stat 3600 -dcache 3600 -daemons 5 -volumes 196 -files 50000"
LARGE="-stat 2800 -dcache 2400 -daemons 5 -volumes 128"
MEDIUM="-stat 2000 -dcache 800 -daemons 3 -volumes 70"
SMALL="-stat 300 -dcache 100 -daemons 2 -volumes 50"

## Type:        yesno
## Default:     yes
#
# Instead of mounting the home cell's root.afs volume at the AFS mount
# point (typically /afs) a fake root is constructed from information
# available in the client's CellServDB.
# With this option enabled openafs can start up even on network outage.
#
DYNROOT=yes" ###initially no

## Type:        yesno
## Default:     yes
#
# use memory-only cache
#
MEMCACHE="no"

## Type:        string(AUTOMATIC)
## Default:     AUTOMATIC
#
# if you set CACHESIZE to "AUTOMATIC", it will automatically be chosen
# deduced by parition sizes (does not work if your cache is on / or
# /usr or /var) or by machine memory size for memory-only cache,
# otherwise the values specified here will be used.
#
#CACHESIZE="AUTOMATIC"


## Type:        string(AUTOMATIC,$XXLARGE,$XLARGE,$LARGE,$MEDIUM,$SMALL)
## Default:     AUTOMATIC
#
# If you set OPTIONS to "AUTOMATIC", the init script will choose a set
# of options based on the cache size, otherwise the values specified here
# will be used.
#
OPTIONS="AUTOMATIC"

## Type:        string(/var/cache/openafs)
## Default:     /var/cache/openafs
#
# Path to cache directory, it is recommended to use separate partition.
# It does not work on reiserfs. A valid directory must be specified
# even if memory only cache is used.
# Recommended cache directory is "/var/cache/openafs"
#
CACHEDIR="/usr/vice/cache"

## Type:        string(/afs)
## Default:     /afs
#
# AFS directory. You should never need to change this
#
AFSDIR="/afs"

## Type:        yesno
## Default:     no
#
# Set to "yes" for a lot of debugging information from afsd. Only
# useful for debugging as it prints _a lot_ of information.
#
VERBOSE="no" ###initially yes

######################################################################

#########I think that the client can be tested against any cell in the
standard CellServDB off the openafs website - it will obviously show
only unauthenticated files - play around
#start the client - no kerberos required - yet
startc
 ls /afs
.:mount  .grand.central.org  .home.ted-doris.fam  grand.central.org 
home.ted-doris.fam

Next the server and kerberos.............


tedc
Martin L&uuml;tken wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">ted creedon wrote:
  
    </pre>
    <blockquote type="cite">
      <pre wrap="">If you compile with the inode option use ext3 since it is a journaling
filesystem and doesn't need an fsck on reboot.

  
    
      </pre>
    </blockquote>
    <pre wrap="">The only place I can find 'inode' in the configure options for OpenAFS
is this line:
 --enable-namei-fileserver             force compilation of namei
fileserver in preference to inode fileserver

Should I leave this option out then when compiling OpenAFS , now I chose
to go with ext3 ?

-Martin



  
    </pre>
    <blockquote type="cite">
      <pre wrap="">I used to user resierfs but have changed to ext3

The reason for two partitions /usr/vice and /vicepxx is that when I move a
raid set of drives all the afs stuff goes with, except for the binaries, e
tc. i.e. on /dev/sda, sda1 could be /usr/vice and sda2 could be vicepa.

Vicepa can also be loopback mounted too

-----Original Message-----
From: Martin L&uuml;tken [<a class="moz-txt-link-freetext" href="mailto:mlu@danware.dk">mailto:mlu@danware.dk</a>] 
Sent: Wednesday, March 21, 2007 8:27 AM
To: <a class="moz-txt-link-abbreviated" href="mailto:tcreedon@easystreet.com">tcreedon@easystreet.com</a>
Subject: SV: [OpenAFS] Initial server setup


Ok! Just one (two) questions:
Should both client cache and /vicepa be 'etx3' and not 'ext2' ?

Seems the other information I have come across so far says to use ext2.

-Martin 


-----Oprindelig meddelelse-----
Fra: ted creedon [<a class="moz-txt-link-freetext" href="mailto:tcreedon@easystreet.com">mailto:tcreedon@easystreet.com</a>]
Sendt: ti 20-03-2007 23:48
Til: Martin L&uuml;tken
Emne: RE: [OpenAFS] Initial server setup
 
PS if you make a new opensuse system use ext3 filesystems and make a
partition:

 

/usr/afs 1gig #client cache

/vicepa  however many gig you want , I use 250gig #server volumes and data

 

This way if you blow the os away, you'll probably be able to save the client
and server data

 

  _____  

From: <a class="moz-txt-link-abbreviated" href="mailto:openafs-info-admin@openafs.org">openafs-info-admin@openafs.org</a> [<a class="moz-txt-link-freetext" href="mailto:openafs-info-admin@openafs.org">mailto:openafs-info-admin@openafs.org</a>]
On Behalf Of Martin L&uuml;tken
Sent: Tuesday, March 20, 2007 8:40 AM
To: <a class="moz-txt-link-abbreviated" href="mailto:openafs-info@openafs.org">openafs-info@openafs.org</a>
Subject: Re: [OpenAFS] Initial server setup

 



Christopher D. Clausen wrote: 

Martin L&uuml;tken  <a class="moz-txt-link-rfc2396E" href="mailto:mlu@danware.dk">&lt;mailto:mlu@danware.dk&gt;</a> <a class="moz-txt-link-rfc2396E" href="mailto:mlu@danware.dk">&lt;mlu@danware.dk&gt;</a> wrote:
  

I tried for a couple of weeks now to set up an openAFS server.
I read through the IBM documentation and surfed the net.
It seems the IBM documentation is somewhat outdated or ?
Should I still use 'kasserver' . Sometimes I find statement saying not
to but IBM documentation use that.
 
I know I shoould perhaps ask more specifically on my current problem,
but I really have tried a lot and sometimes I get a little step
forward ....
IS THERE SOMEWHERE  A STEP BY STEP GUIDE ?
    
      </pre>
    </blockquote>
  </blockquote>
  <pre wrap=""><!---->Not this detailed
  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">    

 
If you connect to the #openafs IRC channel on freenode, there are many 
wonderful people who can help you get started.
 
&lt;&lt;CDC 
 
 
  

Thanks I'll try that :-)





_______________________________________________
OpenAFS-info mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OpenAFS-info@openafs.org">OpenAFS-info@openafs.org</a>
<a class="moz-txt-link-freetext" href="https://lists.openafs.org/mailman/listinfo/openafs-info">https://lists.openafs.org/mailman/listinfo/openafs-info</a>
  

 

_______________________________________________ OpenAFS-info mailing list
<a class="moz-txt-link-abbreviated" href="mailto:OpenAFS-info@openafs.org">OpenAFS-info@openafs.org</a>
<a class="moz-txt-link-freetext" href="https://lists.openafs.org/mailman/listinfo/openafs-info">https://lists.openafs.org/mailman/listinfo/openafs-info</a>


  
    
      </pre>
    </blockquote>
    <pre wrap="">  
    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
  <pre wrap="">
<hr size="4" width="90%">
#! /bin/sh
#set -x
# Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany.
#
# Author: Peter Poeml <a class="moz-txt-link-rfc2396E" href="mailto:poeml@suse.de">&lt;poeml@suse.de&gt;</a>, 2001
#
# /etc/init.d/afs-server
#   and its symbolic link
# /usr/sbin/rcafs-server
#
# System startup script for OpenAFS
#
### BEGIN INIT INFO
# Provides:       afs-client
# Required-Start: $local_fs $named $network
# X-United-Linux-Should-Start: $syslog $time kdc afs-server
# Required-Stop:  
# Default-Start:  3 5
# Default-Stop:   0 2 1 6
# Description:    Start OpenAFS Client
### END INIT INFO


DAEMON="OpenAFS Client"
DAEMON_PIDFILE=
STARTPROC_LOGFILE=
SUPPORTS_HUP="no"
AFS_BIN=/usr/afs/bin
DAEMON_BIN=/usr/local/sbin/afsd
AFS_KERNEL_MODULE=libafs

#test -x $DAEMON_BIN || exit 5

# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     ditto but be verbose in local rc status
#      rc_status -v -r  ditto and clear the local rc status
#      rc_failed        set local and overall rc status to failed
#      rc_failed &lt;num&gt;  set local and overall rc status to &lt;num&gt;&lt;num&gt;
#      rc_reset         clear local rc status (overall remains)
#      rc_exit          exit appropriate to overall rc status
. /etc/rc.status

. /etc/sysconfig/afs-client

CACHEINFO=${CACHEINFO:-/usr/vice/etc/cacheinfo}
CACHE=${CACHEDIR:-/usr/vice/cache}
AFS=${AFSDIR:-/afs}
REGENERATE_CELL_INFO=${REGENERATE_CELL_INFO:-no}
REGENERATE_CACHE_INFO=${REGENERATE_CACHE_INFO:-yes}
MEMCACHE=${MEMCACHE:-yes}
VERBOSE=${VERBOSE:-no}
DYNROOT=${DYNROOT:-yes}
DATA_ENCRYPTION=${DATA_ENCRYPTION:-yes}
THIS_CELL_SERVER_NAME=${THIS_CELL_SERVER_NAME:-unknown}
SERVER_TIMEOUT=120
AFS_CLIENT=/usr/vice/etc

generate_cellinfo() {
    if [ "$REGENERATE_CELL_INFO" = "yes" -a "x$THIS_CELL" != "x" ]; then
        rm -f $AFS_CLIENT/ThisCell #it could be symlinks to server configuration
	echo "$THIS_CELL" &gt; $AFS_CLIENT/ThisCell
	
	if [ -f $AFS_CLIENT/CellServDB -a ! -L $AFS_CLIENT/CellServDB ]; then
	    if grep -q "^&gt;$THIS_CELL\([[:space:]#].*\)\?$" $AFS_CLIENT/CellServDB ; then
	        # CellServDB contains THIS_CELL, replace servers
		awk "
		    /^&gt;$THIS_CELL([[:space:]#].*)?$/   { 
					    this_cell=1; 
					    print \$0;
					    print \"$THIS_CELL_SERVER #$THIS_CELL_SERVER_NAME\";
					    next
				      }
		    /^&gt;/	      {
					    this_cell=0;
					    print \$0;
					    next
				      }
		    /^[^&gt;[:space:]]+/ {
					    if (!this_cell) print \$0;
				      }
		    " $AFS_CLIENT/CellServDB &gt; $AFS_CLIENT/CellServDB.new
	    else
		# add THIS_CELL to CellServDB
		echo "&gt;$THIS_CELL #Cell name, generated from /etc/sysconfig/afs-client" &gt;$AFS_CLIENT/CellServDB.new
		echo "$THIS_CELL_SERVER #$THIS_CELL_SERVER_NAME" &gt;&gt;$AFS_CLIENT/CellServDB.new
		cat $AFS_CLIENT/CellServDB &gt;&gt; $AFS_CLIENT/CellServDB.new    
	    fi
	    mv -f $AFS_CLIENT/CellServDB.new $AFS_CLIENT/CellServDB
	else
	    # new CellServDB
	    rm -f $AFS_CLIENT/CellServDB #it could be symlinks to server configuration
	    echo "&gt;$THIS_CELL #Cell name, generated from /etc/sysconfig/afs-client" &gt;$AFS_CLIENT/CellServDB
	    echo "$THIS_CELL_SERVER #$THIS_CELL_SERVER_NAME" &gt;&gt;$AFS_CLIENT/CellServDB
	fi
    fi
}	

generate_cacheinfo() {
    if [ "$REGENERATE_CACHE_INFO" = "yes" -a "x$CACHESIZE" != "x" ]; then
	if [ "$CACHESIZE" = "AUTOMATIC" ]; then
    	    if [ "$MEMCACHE" = "yes" ]; then
		CACHESIZE=`awk '/^MemTotal:/{ print int($2 / 8);}' /proc/meminfo`
	    else
		LINE=`df -k $CACHE | tail -1`
		PART=`echo $LINE | awk '{ if ( ($NF != "/usr")  &amp;&amp; ($NF != "/") &amp;&amp; ($NF != "/var") ) print $NF; else print "NONE";}'`
		if [ "$PART" = "NONE" ]; then
		    echo "$CACHE is not a separate partition"
		    echo "you have to change the cachesize in $SYSCNF by hand"
		    return 1
		else
		    PARTSIZE=`echo $LINE | awk '{print $2}'`
		    CACHESIZE=`echo $PARTSIZE | awk '{printf "%d",int(($1*.8)/1024)*1024}'`
		fi
	    fi
	fi
	echo $AFS:$CACHE:$CACHESIZE &gt;$CACHEINFO
	chmod 0644 $CACHEINFO
	mkdir -p $CACHE # to be sure
    else
	CACHESIZE=`awk -F: '{print $3}' &lt; $CACHEINFO`
    fi
    return 0
}

choose_afsdoptions() {
    if [ "x$OPTIONS" = "x" -o "x$OPTIONS" = "xAUTOMATIC" ]; then
	if [ $CACHESIZE -lt 131072 ]; then
		OPTIONS=$SMALL
	elif [ $CACHESIZE -lt 524288 ]; then
		OPTIONS=$MEDIUM
	elif [ $CACHESIZE -lt 1048576 ]; then
		OPTIONS=$LARGE
	elif [ $CACHESIZE -lt 2097152 ]; then
		OPTIONS=$XLARGE
	else
		OPTIONS=$XXLARGE
	fi
    fi
    AFSD_OPTIONS="$OPTIONS"
    if [ "$MEMCACHE" = "yes" ]; then
	AFSD_OPTIONS="$AFSD_OPTIONS -memcache"
    fi	
    if [ "$VERBOSE" = "yes" ]; then
	AFSD_OPTIONS="$AFSD_OPTIONS -verbose"
    fi	
    if [ "$DYNROOT" = "yes" ]; then
	AFSD_OPTIONS="$AFSD_OPTIONS -dynroot"
    fi	
}

killafs() {

    SIGNAL=$1
    
    PIDS=`lsof -Fp $AFS | sed -e 's/p//'` 
    
    if [ "x" != "x$PIDS" ]; then 
	kill -$SIGNAL $PIDS &gt;/dev/null 2&gt;&amp;1
	sleep 3
    fi
}

wait_for_server() {
    TIMEOUT=$SERVER_TIMEOUT
    if [ -f $AFS_BIN/bosserver ] &amp;&amp; checkproc $AFS_BIN/bosserver ; then
	# we run on the same machine as the server
	while $AFS_BIN/bos status localhost -localauth |grep -q "salvaging file system"; do
	    echo
	    echo -n "Waiting for local AFS server to come up ..."
	    sleep 1
	    TIMEOUT=$(( $TIMEOUT - 1 ))
	    [ $TIMEOUT -eq 0 ] &amp;&amp; return 1
	done
    fi
    return 0
}

# First reset status of this service
rc_reset

# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
# 
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.

case "$1" in
    start)
	echo "Starting $DAEMON "
	
	mkdir -p $AFS 
	
	if generate_cacheinfo; then 
	    generate_cellinfo
	    choose_afsdoptions

	    if /sbin/modprobe $AFS_KERNEL_MODULE ; then
		if wait_for_server; then
		    ps ax | grep -q '\[aafsd\]' || $DAEMON_BIN $AFSD_OPTIONS || rc_failed 1
		    if [ "$DATA_ENCRYPTION" = "yes" ]; then
			$AFS_BIN/fs setcrypt on	
        	    fi
		    echo "started $DAEMON_BIN $AFSD_OPTIONS"
		else
		    #local server not running
		    rc_failed 1
		fi
	    else
		#modprobe failed
		rc_failed 5
	    fi
	    
	else
	    rc_failed 6
	fi
	# Remember status and be verbose
	rc_status -v
	;;
    stop)
	[ "x`whoami`" = xroot ] || exit 4 # do not allow regular user to kill all his processes
	echo -n "Shutting down $DAEMON "
	if ps ax | grep -q '\[afsd\]'; then
	    echo
	    echo "Sending all processes using $AFS the TERM signal ..." 
	    killafs TERM
	    echo "Sending all processes using $AFS the KILL signal ..." 
	    killafs KILL
    	    umount $AFS
	fi
	if grep -q ^$AFS_KERNEL_MODULE /proc/modules ; then
	    /sbin/rmmod $AFS_KERNEL_MODULE || rc_failed 1
	fi
	# Remember status and be verbose
	rc_status -v
	;;
    try-restart)
	## Stop the service and if this succeeds (i.e. the 
	## service was running before), start it again.
	$0 stop  &amp;&amp;  $0 start

	# Remember status and be quiet
	rc_status
	;;
    restart)
	## Stop the service and regardless of whether it was
	## running or not, start it again.
	$0 stop
	$0 start

	# Remember status and be quiet
	rc_status
	;;
    force-reload)
	## Signal the daemon to reload its config. Most daemons
	## do this on signal 1 (SIGHUP).
	## If it does not support it, restart.

	echo -n "Reload service $DAEMON"

	if [ "$SUPPORTS_HUP" = "yes" ] ; then 
		killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN
		#touch $DAEMON_PIDFILE
		rc_status -v
	else
		$0 stop  &amp;&amp;  $0 start
		rc_status 
	fi
	;;
    reload)
	## Like force-reload, but if daemon does not support
	## signalling, do nothing (!)

	if [ "$SUPPORTS_HUP" = "yes" ] ; then
		# If it supports signalling:
		echo -n "Reload service $DAEMON"
		killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN
		#touch $DAEMON_PIDFILE
		rc_status -v
	else
		## Otherwise if it does not support reload:
		rc_failed 3
		rc_status -v
	fi
	;;
    status)
	echo -n "Checking for $DAEMON: "
	## Check status with checkproc(8), if process is running
	## checkproc will return with exit status 0.

	# Status has a slightly different for the status command:
	# 0 - service running
	# 1 - service dead, but /var/run/  pid  file exists
	# 2 - service dead, but /var/lock/ lock file exists
	# 3 - service not running

	# NOTE: checkproc returns LSB compliant status values.

        ps ax | grep -q '\[afsd\]' || rc_failed 3

	rc_status -v
	;;
    probe)
	## Optional: Probe for the necessity of a reload,
	## give out the argument which is required for a reload.

	if [ "$DAEMON_CONF" -nt "$DAEMON_PIDFILE" ]; then 
		if [ "$SUPPORTS_HUP" = "yes" ]; then 
			echo reload
		else 
			echo restart
		fi
	fi
	;;
    *)
	echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
	exit 1
	;;
esac
rc_exit
  </pre>
  <pre wrap="">
<hr size="4" width="90%">
#! /bin/sh
# set -x
# Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany.
#
# Author: Peter Poeml <a class="moz-txt-link-rfc2396E" href="mailto:poeml@suse.de">&lt;poeml@suse.de&gt;</a>, 2001
#
# /etc/init.d/afs-server
#   and its symbolic link
# /usr/sbin/rcafs-server
#
# System startup script for OpenAFS
#
### BEGIN INIT INFO
# Provides:       afs-server
# Required-Start: $local_fs $named $network
# X-United-Linux-Should-Start: $syslog $time kdc
# Required-Stop:  
# Default-Start:  3 5
# Default-Stop:   0 2 1 6
# Description:    Start OpenAFS Server
### END INIT INFO

AFSBIN="/usr/afs/bin"
DAEMON="OpenAFS Server"
DAEMON_PIDFILE=
STARTPROC_LOGFILE=
SUPPORTS_HUP="no"
DAEMON_BIN=$AFSBIN/bosserver

#test -x $DAEMON_BIN || exit 5

# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     ditto but be verbose in local rc status
#      rc_status -v -r  ditto and clear the local rc status
#      rc_failed        set local and overall rc status to failed
#      rc_failed &lt;num&gt;  set local and overall rc status to &lt;num&gt;&lt;num&gt;
#      rc_reset         clear local rc status (overall remains)
#      rc_exit          exit appropriate to overall rc status
. /etc/rc.status

# First reset status of this service
rc_reset

# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
# 
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.

case "$1" in
    start)
	echo -n "Starting $DAEMON"

	startproc $DAEMON_BIN

	# Remember status and be verbose
	rc_status -v
	;;
    stop)
	echo -n "Shutting down $DAEMON"

        checkproc $DAEMON_BIN &amp;&amp; $AFSBIN/bos shutdown localhost -localauth -wait
	killproc -HUP $DAEMON_BIN
	# Remember status and be verbose
	rc_status -v
	;;
    try-restart)
	## Stop the service and if this succeeds (i.e. the 
	## service was running before), start it again.
	$0 stop  &amp;&amp;  $0 start

	# Remember status and be quiet
	rc_status
	;;
    restart)
	## Stop the service and regardless of whether it was
	## running or not, start it again.
	$0 stop
	$0 start

	# Remember status and be quiet
	rc_status
	;;
    force-reload)
	## Signal the daemon to reload its config. Most daemons
	## do this on signal 1 (SIGHUP).
	## If it does not support it, restart.

	echo -n "Reload service $DAEMON"

	if [ "$SUPPORTS_HUP" = "yes" ] ; then 
		killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN
		#touch $DAEMON_PIDFILE
		rc_status -v
	else
		$0 stop  &amp;&amp;  $0 start
		rc_status 
	fi
	;;
    reload)
	## Like force-reload, but if daemon does not support
	## signalling, do nothing (!)

	if [ "$SUPPORTS_HUP" = "yes" ] ; then
		# If it supports signalling:
		echo -n "Reload service $DAEMON"
		killproc -p $DAEMON_PIDFILE -HUP $DAEMON_BIN
		#touch $DAEMON_PIDFILE
		rc_status -v
	else
		## Otherwise if it does not support reload:
		rc_failed 3
		rc_status -v
	fi
	;;
    status)
	echo -n "Checking for $DAEMON: "
	## Check status with checkproc(8), if process is running
	## checkproc will return with exit status 0.

	# Status has a slightly different for the status command:
	# 0 - service running
	# 1 - service dead, but /var/run/  pid  file exists
	# 2 - service dead, but /var/lock/ lock file exists
	# 3 - service not running

	# NOTE: checkproc returns LSB compliant status values.

        checkproc $DAEMON_BIN	 

	rc_status -v
	;;
    probe)
	## Optional: Probe for the necessity of a reload,
	## give out the argument which is required for a reload.

	if [ "$DAEMON_CONF" -nt "$DAEMON_PIDFILE" ]; then 
		if [ "$SUPPORTS_HUP" = "yes" ]; then 
			echo reload
		else 
			echo restart
		fi
	fi
	;;
    *)
	echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
	exit 1
	;;
esac
rc_exit
  </pre>
</blockquote>
<br>
</body>
</html>