diff options
author | intrigeri <intrigeri@boum.org> | 2013-06-08 08:58:49 +0200 |
---|---|---|
committer | intrigeri <intrigeri@boum.org> | 2013-06-08 08:59:03 +0200 |
commit | 1c6677ebddff17f5efdaddebf19a89ec15d58b3d (patch) | |
tree | 0c877c7205d11c81f9dbe651e314408a259cb27d | |
parent | 0dbac2a1c1f4a8d6ce6c23c2dde52a174e5b4661 (diff) | |
download | backupninja-1c6677ebddff17f5efdaddebf19a89ec15d58b3d.tar.gz backupninja-1c6677ebddff17f5efdaddebf19a89ec15d58b3d.tar.bz2 |
Add option to include rdiff-backup output in reports.
Thanks to David Gasaway <dave@gasaway.org> for the patch.
-rw-r--r-- | examples/example.rdiff | 14 | ||||
-rw-r--r-- | handlers/rdiff.in | 13 |
2 files changed, 25 insertions, 2 deletions
diff --git a/examples/example.rdiff b/examples/example.rdiff index e8ce542..323b3eb 100644 --- a/examples/example.rdiff +++ b/examples/example.rdiff @@ -53,6 +53,20 @@ ## Default: # ignore_version = no +## should backupninja write program output as Info messages rather than Debug +## messages? (default: no) +## Usually rdiff-backup output (for increment expiration and backup) is written +## to output as Debug messages; this option causes backupninja to use Info-level +## messages instead. Since backup reports include Info messages, this option is +## useful to receive output like rdiff-backup session statistics in reports. In +## addition, since rdiff-backup has a habit of using a zero exit code when +## non-fatal errors are encountered (causing backupninja to conclude the backup +## was entirely successful), this option is useful for inspecting non-fatal +## filesystem and permission errors from rdiff-backup. +## +## Default: +# output_as_info = no + ###################################################### ## source section ## (where the files to be backed up are coming from) diff --git a/handlers/rdiff.in b/handlers/rdiff.in index c3c8d1d..471a3d7 100644 --- a/handlers/rdiff.in +++ b/handlers/rdiff.in @@ -85,6 +85,7 @@ getconf testconnect yes getconf nicelevel 0 getconf bwlimit getconf ignore_version no +getconf output_as_info no setsection source getconf type; sourcetype=$type @@ -182,7 +183,11 @@ if [ "$keep" != yes ]; then if [ $test = 0 ]; then output="`su -c "$removestr" 2>&1`" if [ $? = 0 ]; then - debug $output + if [ "$output_as_info" == "yes" ]; then + info $output + else + debug $output + fi info "Removing backups older than $keep days succeeded." else warning $output @@ -268,7 +273,11 @@ debug "$execstr" if [ $test = 0 ]; then output=`nice -n $nicelevel su -c "$execstr" 2>&1` if [ $? = 0 ]; then - debug $output + if [ "$output_as_info" == "yes" ]; then + info $output + else + debug $output + fi info "Successfully finished backing up source $label" else error $output |