aboutsummaryrefslogtreecommitdiffstats
path: root/backuper.sh
diff options
context:
space:
mode:
authorGravatar Robin Obůrka <r.oburka@gmail.com> 2016-07-25 00:06:34 +0200
committerGravatar Robin Obůrka <r.oburka@gmail.com> 2016-07-25 00:06:34 +0200
commit4f7c58dc1d957d6d6d44c897619b5130c4ac026e (patch)
tree283b3e40c45aa2f4c2904df5cf1f2c097bf1a5c9 /backuper.sh
parentSecure RUNDIR (diff)
downloadbackuper-4f7c58dc1d957d6d6d44c897619b5130c4ac026e.tar.xz
Add support for custom stages of pipeline
Diffstat (limited to 'backuper.sh')
-rw-r--r--backuper.sh13
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=$!