Documentation of how to use the RSyncBackup API.

RSyncBAckup API Documentation.

ExpenseClam
Easy-to-use business expense tracker for Android.

ExpenseClam for Android

RSyncBackup

__init__

Args:

  • lastRunFile - The file used to record when the backup was last performed.  If you don't want to use this pass in None.  Defaults to /var/state/backupLastRun.lrf
  • rsync - The location of the rsync binary.  Defaults to /usr/bin/rsync
  • testRun - Defaults to 0 (false).  Set to 1 (true) to perform a dry run, logging out what would have happened.

Desc: The constructor of the RSyncBackup class.  One instance of the class can perform multiple backups.

timeToBackup

Args:

  • backupInterval - The number of minutes to have ellapsed between backups.

Desc: Returns true if it's time to backup.  If the lastRunFile was set to None or does not exist then a warning is logged, but true is still returned.

backup

Args:

  • source - The directory who's contents should be backed up.
  • destination - The destination that the backup should be placed in.
  • archive - Defaults to None.  The destination where old versions of files should be moved to.
  • excludeList - Defaults to None.  A List of strings containing the list of dirs/files that should not be included in the backup (see rsync manual page for details on '--exclude')

Desc: Perform a backup.  This can be called multiple times with different arguments to backup different dirs to different destinations.  Returns true if successful.

trimArchives

Args:

  • archiveDir - The directory where archives are kept.
  • filter - Defaults to None.  A regular expression that allows only paths matching this regex to be trimmed.
  • entriesToKeep - The number of archives to keep, defaults to 10.
  • removeParentIfEmpty - Defaults to true.  Remove parent directories climbing the path if any of them are empty.  This is used to delete month and year directories that have been emptied.

Desc: WARNING: THIS DELETES FILES.  ALWAYS run with testRun set to true and ensure that the archiveDir contains only expendable data when developing your own backup script.  This method will remove old archives that number beyond entriesToKeep.  If in doubt just don't use it...

finish

Args: None
Desc: If a lastRunFile was provided write out the last run time to it.

%nbsp;

Last Modified: Thu, 13 May 2004 02:18:17 BST

Made with PubTal 3.5

Copyright 2013 Colin Stewart

Email: colin at owlfish.com