ip

ip

IP is the main FIP user interface, but it can also be used in command mode
typically to start and stop processes on startup or via crontab.

Main input switches if used for batch files/crontabs :
    -a : start this name/group/program/all      default: no
    -i : start this name/group/program/all then start the local group
                            default: no
    -k : stop  this name/group/program/all      default: no
    -R : run this 'command' and exit        default: no
        the default for -R is NOT to display results for 'k' and 'a'
        use -z to show (on screen) and/or -o to output to a file

Other input switches if used for batch files/crontabs :
    -c : (Pathname or full path-filename in FipSeq) default: none
        Check (and wait) for this file exists before starting properly
        Use this where something major in the copy flow relies on a NAS drive for
example.
        See also -X for number of times to Check before stopping
    -C : for one-off commands (-R -a -k), do NOT chk pids first)    default: do
    -d : run as a daemon in background, do not prompt for input,
        Used for SYSTEM checking only       default: no
    -f : hostname to use for the licence check  default: booted name
    -h : new hostname for the prompt        default: hostname
        Use this if your System Manager has given your UnixBox a name which is too
verbose or meaningless.
    -H : force the IP address to use this       default: host address
    -l : logonname for permissions          default: yourlogon
    -o : output any display to this file        default: do not
    -t : the auto check time            default: 60 sec
    -u : logonname for permissions          default: yourlogon
    -x : do NOT check if this logon is a FIP shell  default: check
        This should only to be used in extremis as the enviroment
        variables usually differ from the system defaults.
    -X : no of times to check file '-c' before stopping default: 1
        set to zero for continuous
        if this is the -d daemon, this will be once per minute
    -V : old style display for WAIT         default: new style
    -w : no of secs to wait on startup for the network  default: none
        Sometimes only the loopback is started first
        Use this to delay the start until the fip licence has an IP address to check
against.
    -y : only run on this hostname/DEST_REDUN host  default: no checking
        eg. use in a batch file running on several system to check it is the primary
when using the -R(cmd)
    -z : always display results from 'kill' or 'activate' or '-R cmd'
    -Z : NEVER  display results from 'kill' or 'activate' or '-R cmd'
    -v : print the version no and quit

Use -R to run a single command (exactly the same as you would enter manually)
and then exit. If there is an embedded space or any shell escape characters in
the command to be run, remember to put it all in double quotes :
    /fip/bin/ip -R "w all"

When using 'ip' in a script, (-a, -k, -R and -i) it is good practice to add a
'&' at the end of the command.

Note that if -l logon is used, queues spool, x, saves and log should be set
chmod -R 777 spool x saves log

There is also a weirdo "-N NT hostname -k ipspool" or -a something to turn
things on and off on a remote NT box.

++ DISKSPACE : The daemon version of 'ip' will check there is sufficent
diskspace every minute or so.
Normally an error message is written to the Fip item log ALL if the disk space
is seriously low (10%)
Three volumes are always checked :
    '/'
    '/fip'
    '/tmp'
If you are using nas/remote/mounted drives, check extra volumes by adding to
the optional tables/sys/DISKSPACE.

An optional Script can also be triggered - perhaps to turn OFF programs that
could run poorly if there is no space

The syntax of DISKSPACE is :

    ; comment line
    (disk)  (percent)   (script with parameters)
    ; eg
    ; /home
    /home   60  /fip/local/test.pl  disk=home
    ; /usr
    /usr    85  /fip/local/test.pl  disk=usr
    ; /var
    /var    60  /fip/local/test.pl  disk=var

++ MIDNIGHT : If there is a file in tables/sys called MIDNIGHT then it is run
by the service within a few seconds after the change of day. The only commands
are 'script:' eg

; MIDNIGHT
; run this at midnight
script:/fip/local/zapwidget.sh

Version Control
;57s36 26aug99  added -r
    ;a moved -r -> -R and -u is now same as -l and -w{newwait}all
    ;b added -H for force IP address
    ;c allow a/k on NT box with -N
    ;d 09may00 small mod - peek -1 for -r.
    ;e 15aug00 added -Z and -z
    ;f 17oct00 added f1, f2 etc
    ;g 12jun01 check diskspace every minute pls
    ;h 17sep02 redid locking slightly
    ;i 01jan03 MACOSX
    ;j 05dec03 allow seqno change via batch as in "/fip/bin/ip -R 'z SFFIIM 888'"
    ;k 05mar04 cleanup
    ;l-n 17sep04 added filter to tail
    ;o-p 28dec05 added diskspace scripts
    ;q 19jul06 64bit error codes mod
    ;r 03feb07 added -b bin folder
    ;s 26nov08 added -f ;1 added folders to 'w' ;3-5 multiple ipaddresses ;6 for
unix date
    ;7 added -C and Pid file
    ;8-9 1oct11 added micro/widget and midnight
    ;11 14jun12 -R now gives an error exit if unable to kill or activate
    ;12 allow WAIT queues to be parsable
    ;13-14 copy x/SYSTEM to log/saves on kall
    ;15 better hunting for error.h and x/woops !x->!z
    ;16 16aug16 check for the x/IP_DAEMON.FIP first - if -d, replace it !
    ;17 allow seqno to INT_MAX not 999 ;18-22 added junix
    ;23 30nov18 added 0w 10 for no of secs to wait on startup for the network
    ;24-25 14jan19 added -c chkfile
    ;26-30 -R tuning-do_demon (27 and 28 are BAD) plus grep -a ;31-33 added -k
onlyhost
    ;34-35 -c better : now 'kall' on loss
    ;36 31aug23 MSYS tuning/paths
;056    14may99 zap x/SYSTEM on 'kall'
;055    10apr99 added stat(v)fs as 'u'

(copyright) 2024 and previous years FingerPost Ltd.