iprobin

iprobin

This program is used to send files to output devices in a round robin fashion.

It can (optionally) check whether the remote system is running or not by
executing a script beforehand - which you my friend have to write. If the
script exits normally, that system is ok; if not, we move to the next system or
entry.

The list of Systems and queues to send to is held in a parameter file in
tables/setup. This file is normally called ROBIN.

Keywords for ROBIN parameter file are :
    ; comment line
    system: (Host Name)  with series of one or more subparameters (see below)
            There must be at least one system line
Optional keywords :
    quiet:      If the remote host is Offline, do NOT log
            eg: quiet:
    filename:   FipSeq for a new filename for the output file
            eg: newname:\XK.\$d
    login:      Logon name for the remote or local system
            This sets file and RCP permissions
            eg: login: ripexpress
    file-pause: (seconds)
            Pause between files     default is zero for no pause

The SYSTEM Subparameters can be (all optional though there must be one !) :
    locqueue:   (Name of the Queue if Thishost)
    local-queue:    (Name of the Queue if Thishost)
OR  locscript:  (Script Name if ThisHost)
OR  local-script:   (Script Name if ThisHost)
    remqueue:   (Name of the Queue if remote system)
    remote-queue:   (Name of the Queue if remote system)
OR  remscript:  (Script Name if remote system)
OR  remote-script:  (Script Name if remote system)
PLUS OPTIONALLY
    remote-test:
    remtest:    (Script for testing whether the remote system is running)
            The hostname is passed as the parameter to this script.
    retry:      (no of seconds before we retry an offline system)
    backup:     (hostname of backup)
            If the main system is down, send to this system
    rcp-program:    Name of program to use for RCP if not 'rcp'
                rcp-program:/usr/bin/scp
    rsh-program:    Name of program to use for RSH if not 'rsh'

where   Host Name is the name in /etc/hosts of the remote system
    Script Name is the script to run on whichever system to do whatever checks and
copies, moves etc are needed. Note you do have to write this script! 
    The 'remtest' script should essentially do a ping
    Remote Queue uses RCP to send the file(s).
        change with 'rcp-program:'
    Remote Script uses RSH to access and run the script or program on the remote.
        change with 'rsh-program:'
    Make sure the remote system will allow an RCP or an RSH with that login and
make changes to .rhosts and host.equiv on the relevant box. Try manually doing
the command before adding to the parameter file. - If it does not work manually
then it will NOT work via 'iprobin'.

Example of a three system round-robin :
system:rip1 retry:120   remtest:robinping   remqueue:/data1/rip/input
system:rip2 retry:120   remtest:robinping   remqueue:/raid3/rip/input
system:rip3 retry:120   remtest:robinping   remqueue:/disk77/rip/input
where   - rip1, rip2 and rip3 are valid Unix hosts in the /etc/hosts file.
    - each offline system is retried after at least 120 seconds.
    - the script /fip/local/robinping returns 0 for OK or non-zero if in error.
    - if the test is OK, the file is RCPed to the relevant queue.

Example of a single system with a disaster backup :
system:opi  retry:60    remtest:opitest  backup:opibackup
remscript:/apps/bin/imgprep

Pls never allow any of your scripts to loop as iprobin waits for completion
before continung !

Where sections of FipHdr fields are required or changes to the output style,
use keywords : fixed, partial, combie, optional, repeat, newdate and/or style.
(see The SysAdmin manual for more information).

    They are normally specified :
        fixed:QZ    1234543
        partial:QT  ST,3,2,U,<,>
        combie:QY   ep|na,(0000000)a 
        option:QE   ep,11,7,s
        repeat:QK   XK,-,3  
    or  repeat:QP   PK,,4,#X
        style:QS    XN,%.03d 
        newdate:QT  hours+3 "\ZD"

Input Parameters are (all optional) :
    -i : input queue            default: spool/2robin
        If this does NOT start with a '/', it is assumed under spool.
    -o : output or done queue       default: file is deleted
        If this does NOT start with a '/', it is assumed under spool.
        If left blank, the input file is deleted.
    -z : parameter file in tables/setup default: tables/setup/ROBIN
    -Z : look at the Fip Hdr field DF for the parameter file
        and if NOT found, use the default   default: no
    -w : file wait for files arriving across a network. def: 0 secs
    -u : owner if not that of the logon default: logon at start
    -l : do NOT log files in        default: log
    -v : print version number and exit

Example of a 'remtest' file :

system:bigboy   retry:120   remtest:robinping   remqueue:/data1/input

#!/bin/sh
#
#   ROBINPING
#   Ping remote system - hostname (which MUST be in /etc/hosts) is parameter 1
#
loggo=/fip/log/ALL
baso=`basename $0`
tmpo=/fip/x/PINGTMP
#
# Nothing Specified at all
if ( test "$1" ) then
    echo -n
else
    # loggit
    ac=`date "+%a %h %d %T"`
    echo "$ac !!! $baso No Host Specified !!!" >> $loggo

    exit 2;
fi
#
# zap tmp file
/bin/touch $tmpo
/bin/rm -f $tmpo
#
# ping it
# RS6000 ping
if ( ping -c 2 -q "$1" > $tmpo ) then
# SPARC ping
##if ( ping "$1" 2> $tmpo ) then
#   echo ping ok
    exit 0
else
#   echo ping NOT ok
    exit 1
fi

Version Control
;03d    14jun01 DIDNOT added lowest-count
        ;a 27oct03 added file-pause: **CHANGE - was pause of 2 seconds ;c link not
copy for local_copy

(copyright) 2024 and previous years FingerPost Ltd.