|
NAMEcharon.ftp - remove backup files that exceed a certain age from an FTP aite SYNOPSIScharon.ftp --host host [--ssl] --user name (--password password | --readpassword) [--dir directory] --maxage days (--profile identifier | --all) [--truncate] [--dry-run] [--verbose] [--help] The program charon.ftp removes backup archives created by tartarus from an FTP server once they reach a certain age and expire. Files that are older than the number of days specified on the command line are considerer candidates for removal unless other, non-expired backups are based on them, so full backups may survive longer than expected. OPTIONS AND ARGUMENTS
EXAMPLEUsing the script is fairly simple and can probably be best explained by looking at an example: $ charon.ftp --host safehaven --user john --password SECRET --dir / --maxage 7 --profile home --verbose --dry-run This command line will try to log into the server "safehaven" using the user name "john" and his password "SECRET" and remove backup file from the profile "home" with are more than 7 days old. Due to the command line switch "--dry-run", no files are actually deleted - the script will only explain its potential actions in its output. Integration with TartarusCharon does not (and in fact, cannot) read tartarus backup profiles; by using hooks however it can be called from Tartarus after completing a successfull backup run. This way, Tartarus can pass the configuration variables to Charon: # Hook in Charon
TARTARUS_POST_PROCESS_HOOK() {
# pass configuration variables to charon
# transmit the password through stdin to hide it from "ps ax"
local CHARON="/usr/sbin/charon.ftp"
local MAX_AGE_IN_DAYS="7"
echo -n "$STORAGE_FTP_PASSWORD" | $CHARON \
--host "$STORAGE_FTP_SERVER" --user "$STORAGE_FTP_USER" \
--readpassword \
--dir "$STORAGE_FTP_DIR" \
--maxage "$MAX_AGE_IN_DAYS" \
--profile "$NAME"
}
TARTARUS_POST_PROCESS_HOOK will only be executed in case of a successfull backup, so there won't be any files removed if tartarus encounters an error during the new backup creation. AUTHORStefan Tomanek <stefan.tomanek@wertarbyte.de>
|