Package: backupninja Version: 0.9.4-unreleased Severity: wishlist Tags: patch
Support for executing command before backup and also after backup. This is required when doing backup on not permanently mounted partition. I tried to implement this feature. See following patch. --- backupninja.orig 2006-08-22 09:11:22.000000000 +0200 +++ backupninja 2006-08-26 10:19:47.000000000 +0200 @@ -300,20 +300,39 @@ echo "" > $bufferfile echo_debug_msg=1 ( - . $scriptdirectory/$suffix $file + getconf preexec "" + getconf postexec "" + + error=0 + if [ "$preexec" ]; then + eval $preexec + error=$? + fi + + if [ $error == 0 ]; then + . $scriptdirectory/$suffix $file + error=$? + [ $error != 0 ] && echo "Fatal: Backup action exited with code $error" + else + echo "Fatal: Backup was aborted. Preexec action exited with code $error" + fi + + if [ "$postexec" ]; then + eval $postexec + error=$? + [ $error != 0 ] && echo "Warning: Postexec action exited with code $error" + fi ) 2>&1 | ( while read a; do echo $a >> $bufferfile [ $debug ] && colorize "$a" done ) - retcode=$? - # ^^^^^^^^ we have a problem! we can't grab the return code "$?". grrr. echo_debug_msg=0 - _warnings=`cat $bufferfile | grep "^Warning: " | wc -l` - _errors=`cat $bufferfile | grep "^Error: " | wc -l` - _fatals=`cat $bufferfile | grep "^Fatal: " | wc -l` + _warnings=`grep -c "^Warning: " $bufferfile` + _errors=`grep -c "^Error: " $bufferfile` + _fatals=`grep -c "^Fatal: " $bufferfile` ret=`grep "\(^Warning: \|^Error: \|^Fatal: \)" $bufferfile` rm $bufferfile -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]