Skip to content

Instantly share code, notes, and snippets.

@zzamboni
Created August 23, 2010 06:48
Show Gist options
  • Save zzamboni/544952 to your computer and use it in GitHub Desktop.
Save zzamboni/544952 to your computer and use it in GitHub Desktop.
#
# Sample cf3 implementation of "single copy nirvana" from
# http://cfwiki.org/cfwiki/index.php/Singlecopy_Nirvana
#
# Time-stamp: <[cf3-singlecopy.cf] modified by Diego Zamboni on Monday, 2010.08.23 at 01:44:19>
#
body common control
{
bundlesequence => { "copyfiles" };
}
# Use single copy for all files
body agent control
{
files_single_copy => { ".*" };
}
######################################################################
bundle agent copyfiles
{
vars:
# Suffixes to try, in most-specific to most-general order. This must include the
# empty suffix at the end, for the most general file.
# In this example I'm taking them from the system variables, but they could
# be anything.
"copysuffixes" slist => { ".${sys.uqhost}", ".${sys.domain}", ".${sys.os}", "" };
# List of files to copy
"filestocopy" slist => { "test1", "test2", "test3" };
# Source of the files
"repo" string => "/tmp/testrepo";
# Destination for the files
"dest" string => "/tmp/testdest";
files:
"${dest}/${filestocopy}"
copy_from => hierarchical_copy("${filestocopy}");
}
body copy_from hierarchical_copy(from)
{
source => "${repo}/${from}${copysuffixes}";
compare => "digest";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment