From 4f7c58dc1d957d6d6d44c897619b5130c4ac026e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Ob=C5=AFrka?= Date: Mon, 25 Jul 2016 00:06:34 +0200 Subject: Add support for custom stages of pipeline --- backuper.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 <