diff options
-rw-r--r-- | backuper.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/backuper.sh b/backuper.sh index 67eb92b..84bf943 100644 --- a/backuper.sh +++ b/backuper.sh @@ -37,6 +37,7 @@ PID_STORE="" PID_FILE="pids" STAGE="0" PIPELINE_FILE_TYPE="bz2.gpg" +CUSTOM_STAGE_FILE="custom_stage" ## Internal variables - program logic CONFIG_FILE_NAME=".backuper.sh.conf" @@ -156,6 +157,10 @@ store_file() { store "sh -c 'cat > ${DST}/${FILENAME}'" } +add_custom_stage() { + echo "$@" >> "$RUNDIR"/"$CUSTOM_STAGE_FILE" +} + ## Internal functions test_input() { [ -z "$NAME" ] && error "Specify backup name" @@ -266,6 +271,14 @@ start_pipeline() { ## PID that I'm not able to get (event from list of children). ## ... and it takes 100% CPU. So, for now: Do not use mbuffer as the last one. #add_stage "mbuffer -q -m "$MBUFFER_SIZE"" + if [ -f "$RUNDIR"/"$CUSTOM_STAGE_FILE" ]; then + while read LINE; do + add_stage "$LINE" + done <<EOT + $(cat "$RUNDIR"/"$CUSTOM_STAGE_FILE") +EOT + ## While loop is executed in subshell - this hack keeps variables + fi start_store || die "Store command failed" & PID_STORE=$! |