aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--backuper.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/backuper.sh b/backuper.sh
index 19ebd67..88fa769 100644
--- a/backuper.sh
+++ b/backuper.sh
@@ -14,6 +14,7 @@ COMMAND=""
PLACES=""
EXCLUDE=""
STORE=""
+AFTER=""
## Pipeline variables
PID_GENERATE=""
@@ -65,6 +66,10 @@ store() {
STORE="$1"
}
+after() {
+ AFTER="$1"
+}
+
error() {
echo "ERROR: $1" >&2
exit 1
@@ -103,6 +108,14 @@ get_home() {
echo "$CU_HOME"
}
+result_file() {
+ if [ -n "$DST" ]; then
+ echo "$DST"/"$FILENAME_ENC"
+ else
+ echo "$FILENAME_ENC"
+ fi
+}
+
prepare() {
echo "prepare $$"
trap 'error_handler' EXIT INT QUIT TERM ABRT HUP ILL TRAP BUS FPE SEGV
@@ -192,6 +205,13 @@ start_pipeline() {
done
}
+backup_done() {
+ if [ -n "$AFTER" ]; then
+ title "After backup hook"
+ echo "$AFTER" | sh -s || die "After-backup hook failed"
+ fi
+}
+
run() {
title "Run command"
echo "$@"
@@ -208,6 +228,7 @@ backup() {
test_input
prepare
start_pipeline
+ backup_done
cleanup
}