Project

General

Profile

Reference

Command line

sam_cp src_uri destination_uri

Looks in $SAM_CP_CONFIG_DIR for its configuration file, which the table file defines as
${UPS_THIS_DB}/sam_cp/config. The config file is named "sam_cp.cfg".

Configuration file

The sam_cp configuration file has one [sam_cp] stanza, followed by one
or more rule stanzas.

sam_cp stanza

The sam_cp stanza currently only specifies the log file used to keep
from performing duplicate copies.

[sam_cp]
logfile=/tmp/cplog

rule stanzas

The rule stanzas have a name in brackets, and then can have one or more of the
following:

  1. srcre -- regular expression to match againts the src_uri of the copy
  2. dstre -- regular expressino to match against the dst_uri of the copy
  3. srcrepl -- string to replace the srcre match
  4. dstrepl -- string to replace the dstre match
  5. envset -- environment variable(s) to set when making the copy (usually IFDH_FORCE)
  6. command -- command to use intead of ifdh cp.
  7. lscommand -- command to use instead of ifdh ls to check for directories -- you can set this to /bin/true or : to not check for directories, i.e. if your copy command is set to make intervening directories (i.e. with -cd to globus-url-copy)
  8. mkdircommand -- command to use instead of ifdh mkdir to make directories

The rule is only applied if the source and destination regular expressions both
match. (if they are ommited they default to '.*' which matches anything).
So if you omit both srcre and dstre, you have a rule that applies to everything.
So you can make a config that always copies to a given destination, or makes us
always use /opt/wherever/super_shiny_copy, by having neither srcre nor destre,
and specifying dstrepl, or command, respectively.

If a src or dest replacement is given it replaces the matching regular expression.
Replacements can contain \1 \2 references against the parenthesized components of the
regular expression, or you can use python's \g<0> to match the entire thing.

envset lets you set environment variables; usually IFDH_FORCE for ifdh cp, or
IFDH_GRIDFTP_EXTRA to pass extra flags to gridftp, etc.

You can also give a command to copy things.

Sample config file

[sam_cp]
logfile=/tmp/cplog

[novadata_src]
srcre: novadata:/nova/data/
srcrepl: gsiftp://if-gridftp-nova.fnal.gov/nova/data/
envset: IFDH_FORCE=gridftp

[novadata_dst]
dstre: novadata:/nova/data/
dstrepl: gsiftp://if-gridftp-nova.fnal.gov/nova/data/

[bel-kwinith_scp]
dstre: bel-kwinith:/tmp
dstrepl: mengel@\g<0>
command: scp -o 'GSSAPIDelegateCredentials no'

This config has a sam_cp section specifying the logfile; a rule sending access
to /nova/data/ through if-gridftp-nova, and setting IFDH_FORCE=gridftp when it
is the source; and finally sending things destined to bel-kwinith:/tmp via
scp with an option set.