DataMuseum.dk

Presents historical artifacts from the history of:

RC9000

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about RC9000

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: @ T f

⟦f74ff7019⟧ TextFile

    Length: 2791 (0xae7)
    Types: TextFile
    Notes: @(#)fb.csh 13.1 (RC International) 91/02/02
    Names: »fb«

Derivation

└─⟦50656ff4a⟧ Bits:30010538 TX 3.1 Coldstart
    └─⟦bbf173f5c⟧ »0004« 
        └─⟦this⟧ »./etc/fb« 

TextFile

#! /bin/csh -f
#
# @(#)fb.csh	13.1 (RC International) 91/02/02
#

set PU = `puname`
set path = ( /$PU/etc /$PU/bin /$PU/usr/bin /$PU/usr/ucb )
set parg = ""
set txt = ""
@ vmode = 0
while ( $#argv )
  switch ( $argv[1] )
  case "-f" :
	set parg = ( $parg $argv[1] ); shift argv; breaksw
  case "-[dn]" :
	if ( $#argv <= 1 ) then
	  echo \	$argv[1] parameter expected.
	  goto usage
	endif
	set parg = ( $parg $argv[1] $argv[2] ); shift argv; shift argv
	breaksw
  case "-v" :
	@ vmode = 1; shift argv; breaksw
  default :
	goto usage
  	breaksw
  endsw
  continue
  usage:
	echo "usage :	fb [-f] [-n retry-num] [-d delay-sec] [-v]"
	exit 1 
end

set tm = /$PU/tmp/mount.$$
mount >! $tm
set tv = /$PU/tmp/vol.$$
egrep "^([^#]*)${PU}([^#]*)#@#" /etc/voldesc >! $tv

@ i = 1
while (1)
    set in = `sed -n "${i}p;${i}q" $tv`
    @ i++
    set on = ( $in )
    if ( "x$on" == "x" ) break;

    # discard "lv"
    if ( $on[1] == "lv" ) then
	shift on
    else
badlv:
	echo bad lv line \" $in \"
	exit 1
    endif

    # get vol name
    set lv = $on[1]
    if ( $vmode ) set txt = "$lv"
    shift on
    # in release 2.0 we will not fail over root - gives (v)fork() problems
    if ( $lv == "root" ) then
	continue
    endif

    # get dev node name
    set dev = $on[1]
    if ( $vmode ) set txt = "$txt $dev"

    # discard "root" or "swap" or "data"
    if ( $on[2] == "root" || $on[2] == "swap" || $on[2] == "data" ) then
	shift on
    else
	goto badlv
    endif

    # pick up mount point name and primary pu
    unset mp ppu
    while ( 1 )

	# check for end of line
	if ( $#on < 2 ) break
	shift on

	# discard "auto"
	if ( $on[1] == "auto" ) then
	    continue
	endif

	# check for mount point name
	if ( $on[1] =~ /* ) then
	    if ( $lv == "root" ) then
		# mount point for global root is in the local root 
		set mp = "/${PU}$on[1]"
	    else
		set mp = $on[1]
	    endif
	    if ( $vmode ) set txt = "$txt $mp"
	    continue
	endif

	# must be primary or secondary pu name
	if ( ! $?ppu ) then
	    set ppu = $on[1]
	    if ( $vmode ) set txt = "$txt $ppu"
	endif
	break
    end

    # did we get mount point ?  was a primary pu specified ?
    if ( ! $?ppu || ! $?mp ) continue

    # check current mount state
    set cpu = `egrep "^$lv " $tm | cut -f3`
    if ( $vmode ) set txt = "$txt $cpu"

    if ( $vmode ) then
	echo "$txt" | \
	awk '{ \\
	  printf "%-10.10s %-17.17s %-15.15s primary: %-8.8s owner: %-8.8s\n",\\
		$1, $2, $3, $4, $5 \\
	}'
    endif

    # are we primary?
    if ( $ppu != $PU ) continue

    # determine if it should be moved
    if ( "x$cpu" != "x$ppu" ) then
	if ( "x$cpu" != "x") then
	    if ( $vmode ) then
		echo "	fail-back: primary $parg $lv $mp $dev"
		echo ""
	    endif
	    ( primary $parg $lv $mp $dev & )
	endif
    endif

end

rm -f $tm $tv