From: "Fotis Georgatos (RIPE-NCC)" 
Date: Tue, 04 Jul 2000 18:50:38 +0200
Subject: Re: [ripe-ttraffic #21444] tt_sync & CFE introduction
Hoi,

"Henk Uijterwaal (RIPE-NCC)" wrote:
> > tt_sync exists, now we must prefer it and agree on its usage ;-)
> 
> OK, please give a (pointer to a) reference on how to use it.

Great, here it follows:

In principle tt_sync's interface is like update_testbox[_2], but note:
 * Default mechanism is rdist (--rdist), but --rsync is better for ttraffic
 * dry-run is now option -n (much more standard for scripts)
 * All machines that are ONLINE are updated (SETUP|WATCH|ON)
 * correct proto directory is automagically used, according to config
   ( requires that files are placed in both proto directories)
 * rsync in real mode (not dry-run) would only report changes with -V (verbose)
  => operator: please use -V, to get a clue of what happens
  => scripts:  "tt_sync -n ...", then "tt_sync ..."
 * -b (=binary check) is mandatory for groupA's tricks with timestamps

We can save ourselves from some diversity by doing regular updates,
and using standard methods for updating the chain (eg. coded in CFE).
Next email will demonstrate some examples.

Hint: Running tt_sync without options will just print usage!

===
[ttraffic@x21:7] tt_sync
ERROR: no hosts to update?
Syntax:  tt_sync [-h] [--rsync|--rdist] [-V] [-n] [-d] [-S] [-b] -a| -f


-h         -   Provide detailed syntax and available options

--rsync    -   Use rsync tool for file transfers & comparisons
--rdist    -   Use rdist tool for file transfers & comparisons (default)
-V         -   Verbose output, increase amount of reported information; for
operator usage
-n         -   Dry run: check but do not change files on the destination host
-d         -   Debug mode: Print the rdist/rsync command(s) without executing
-S         -   Strict checks, delete remote files that don't exist locally; use
with caution!
-b         -   Binary or checksum comparison (default is to use timestamp & size)
-a         -   update files on all online available testboxes 
 -   space separated list of testbox hostnames; only hostname,
.ripe.net assumed
 -   a list of remote files or directories to be updated; use absolute
pathnames

The script should be run either with full pathname or directly 
from the /ncc/test-traffic/SETUP/INSTALL/bin directory
Each file/dir will be searched in the trees in the following order:
a) /ncc/test-traffic/SETUP/INSTALL/files/HOST_specific
b) /ncc/test-traffic/SETUP/INSTALL/rdist_trees/proto_test_box[_2]
if it does not exist there the relevant 'proto_test_box' tree will be searched.

-- The statistician drowned in a lake averaging only 2 feet in depth.
Fotis Georgatos , nic-hdl:     FMG21-RIPE




===========================================================================
X-Request-Action: Comments added by fotis@ripe.net.
From: "Fotis Georgatos (RIPE-NCC)" 
Date: Tue, 04 Jul 2000 19:06:02 +0200

So,

> We can save ourselves from some diversity by doing regular updates,
> and using standard methods for updating the chain (eg. coded in CFE).
> Next email will demonstrate some examples.

$ /ncc/ttpro/config/cfengine.conf -DSyncCFEfiles # I often use this to distribute
cfe states etc
$ /ncc/ttpro/config/cfengine.conf -DTestTT -DSyncTT" # will first check then
update ttraffic SW
$ /ncc/ttpro/config/cfengine.conf -DTestTT -n" # will show the commands to
execute for TestTT

The file /ncc/ttpro/config/cf.TTM_local has the rules, and is imported by the
main
cfengine.conf. In the same place, someone can define precopying from
CVS/repositories
to proto directories before SW distribution, auto generation of configuration
files etc.

It should be considered as a Makefile:

#------------------------------------------------------------------------------
# Shellcommands: copy CFE files to prototype dirs, etc
#------------------------------------------------------------------------------

# Create the file with information about "states"
cf||CRON.x21.Hr05.Min30::
#SyncCFEfiles||cf||CRON.x21.Hr00.Min00::
  "/home/ttraffic/config/bin/groups2cf >$(TTM_root)/config/cf.states"
  "/bin/chmod 644 $(TTM_root)/config/cf.states"

# Copy from master cfe files to the prototype directories.
SyncCFEfiles::
  "/bin/cp -p $(TTM_root)/config/cf.states $(TTM_root)$(PROTO_DIR)$(CFE_target)"
  "/bin/cp -p $(TTM_root)/config/cf.states
$(TTM_root)$(PROTO_DIR)_2$(CFE_target)"
  "/bin/cp -p $(TTM_root)/config/cf.Testboxes
$(TTM_root)$(PROTO_DIR)$(CFE_target)"
  "/bin/cp -p $(TTM_root)/config/cf.Testboxes
$(TTM_root)$(PROTO_DIR)_2$(CFE_target)"
  "/bin/cp -p $(TTM_root)/config/cfengine.conf
$(TTM_root)$(PROTO_DIR)$(CFE_target)"
  "/bin/cp -p $(TTM_root)/config/cfengine.conf
$(TTM_root)$(PROTO_DIR)_2$(CFE_target)"

# Copy from master crontab to the prototype directories
SyncCrontabs::
  "/bin/cp -p $(TTM_root)/cron/crontab-for-BSDs
$(TTM_root)$(PROTO_DIR)$(CRON_target)"
  "/bin/cp -p $(TTM_root)/cron/crontab-for-BSDs
$(TTM_root)$(PROTO_DIR)_2$(CRON_target)"

#------------------------------------------------------------------------------
# SW updates for the chain *BE CAREFUL*
# When unsure, try eg: ./cfengine.conf -DSyncCFEfiles -n
#------------------------------------------------------------------------------

SyncCFEfiles::
  # Update chain with the configuration files
  "$(TTM_root)/SETUP/INSTALL/bin/tt_sync    -b --rsync tt02 -f
$(CFE_target)/cfengine.conf $(CFE_target)/cf
.states $(CFE_target)/cf.Testboxes"
  "$(TTM_root)/SETUP/INSTALL/bin/tt_sync    -b --rsync -a   -f
$(CFE_target)/cfengine.conf $(CFE_target)/cf
.states $(CFE_target)/cf.Testboxes"
SyncCrontabs::
  "$(TTM_root)/SETUP/INSTALL/bin/tt_sync    -b --rsync tt02 -f
/usr/home/ttraffic/crontab"
  "$(TTM_root)/SETUP/INSTALL/bin/tt_sync    -b --rsync -a   -f
/usr/home/ttraffic/crontab"
TestTT||CRON.x21.Hr05.Min30::
  "$(TTM_root)/SETUP/INSTALL/bin/tt_sync -n -b --rsync tt02 -f
$(INSTALL_FILES_for_TTRAFFIC)"
  "$(TTM_root)/SETUP/INSTALL/bin/tt_sync -n -b --rsync -a   -f
$(INSTALL_FILES_for_TTRAFFIC)"
SyncAll||SyncTT::
# "$(TTM_root)/SETUP/INSTALL/bin/tt_sync    -b --rsync tt02 -f
$(INSTALL_FILES_for_TTRAFFIC)"
  "$(TTM_root)/SETUP/INSTALL/bin/tt_sync    -b --rsync -a   -f
$(INSTALL_FILES_for_TTRAFFIC)"
SyncAll||SyncRoot::
# "$(TTM_root)/SETUP/INSTALL/bin/tt_sync -n -b --rdist tt02 -f
$(INSTALL_FILES_for_ROOT)"
# "$(TTM_root)/SETUP/INSTALL/bin/tt_sync -n -b --rdist tt02 -f
$(INSTALL_ETC_FILES_for_ROOT)"
  "$(TTM_root)/SETUP/INSTALL/bin/tt_sync -n -b --rdist   -a -f
$(INSTALL_FILES_for_ROOT)"
  "$(TTM_root)/SETUP/INSTALL/bin/tt_sync -n -b --rdist   -a -f
$(INSTALL_ETC_FILES_for_ROOT)"

Yes, tt02 is our development machine, so it's not updated by default.


Enough for now, one piece at a time :-)

cheers,
Fotis

-- The statistician drowned in a lake averaging only 2 feet in depth.
Fotis Georgatos , nic-hdl:     FMG21-RIPE