File-DirSync
view release on metacpan or search on metacpan
$dirsync->maxskew( 7200 );
If the maxskew method is not called, then no corrections to the files or
directories will be made. If no argument is passed, then future_seconds
is assumed to be 0, meaning "now" is considered to be the farthest into
the future that a file should be allowed to be modified.
ignore( <node> )
Avoid recursing into directories named <node> within source_directory.
It may be called multiple times to ignore several directory names.
$dirsync->ignore("CVS");
This method applies to both the rebuild() process and the dirsync()
process.
lockfile( <lockfile> )
If this option is used, <lockfile> will be used to ensure that only one
dirsync process is running at a time. If another process is concurrently
running, this process will immediately abort without doing anything. If
<lockfile> does not exist, it will be created. This might be useful say
for a cron that runs dirsync every minute, but just in case it takes
longer than a minute to finish the dirsync process. It would be a waste
of resources to have multiple simultaneous dirsync processes all
attempting to dirsync the same files. The default is to always dirsync.
verbose( [ <0_or_1> ] )
$dirsync->verbose( 1 );
Read verbose setting or turn verbose off or on. Default is off.
localmode( [ <0_or_1> ] )
Read or set local directory only mode to avoid recursing into the
directory descent.
$dirsync->localmode( 1 );
Default is to perform the action recursively by descending into all
subdirectories of source_directory.
nocache( [ <0_or_1> ] )
When mirroring from source_directory to destination_directory, do not
assume the rebuild() method has been run on the source already to
rebuild the dirsync cache. All files will be mirrored.
$dirsync->nocache( 1 );
If enabled, it will significantly degrade the performance of the
mirroring process. The default is 0 - assume that rebuild() has already
rebuilt the source cache.
gentle( [ <percent> [, <ops> ] ] )
Specify gentleness for all disk operations. This is useful for those
servers with very busy disk drives and you need to slow down the sync
process in order to allow other processes the io slices they demand. The
<percent> is the realtime percentage of time you wish to be sleeping
instead of doing anything on the hard drive, i.e., a low value (1) will
spend most of the time working and a high value (99) will spend most of
the time sleeping. The <ops> is the number of disk operations you wish
to perform in between each sleep interval.
$dirsync->gentle( 25, 1_000 );
If gentle is called without arguments, then some default "nice" values
are set. If gentle is not called at all, then it will process all disk
operations at full blast without sleeping at all.
proctitle( [ procname ] )
Enable proctitle mode which shows the current operation on the process
title. If procname is specified, then it shows that string in the "ps"
listing. Otherwise, the current $0 is used. This is mostly for progress
tracking for convenience purposes.
$dirsync->proctitle( "SYNCING" );
Default is not to alter the process title at all.
tracking( [ <0_or_1> ] )
Enable or disable tracking mode. Operation tracking is disabled by
default in order to reduce CPU and memory consumption. See entries_*
methods below for more details.
entries_updated()
Returns an array of all directories and files updated in the last
"dirsync", an empty list if it hasn't been run yet.
entries_removed()
Returns an array of all directories and files removed in the last
"dirsync", an empty list if it hasn't been run yet.
entries_skipped()
Returns an array of all directories and files that were skipped in the
last "dirsync", an empty list if it hasn't been run yet.
entries_failed()
Returns an array of all directories and files that failed in the last
"dirsync", an empty list if it hasn't been run yet.
TODO
Support for efficient incremental changes to large log files using md5
checksum comparison on portions of or all of corresponding parts of both
the larger source and smaller destination files. If no differences are
found anywhere, including the very end of the destination file, then
simply append the end of the source to the end of the destination until
both files are identical again. Avoid making a full copy of the source
and especially avoid writing the entire file since writes are so slow
and plainful.
( run in 0.481 second using v1.01-cache-2.11-cpan-39bf76dae61 )