Initial attempt at rsync.net backup solution.
[clinton/scripts.git] / rsync.net-move-over
diff --git a/rsync.net-move-over b/rsync.net-move-over
new file mode 100755 (executable)
index 0000000..74d3cf6
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+BACKUPDIR=/vicepa/hcoop-backups/files
+
+function move_over () {
+    # Move file to its final destination.
+    # Expects the file to come from STDIN.
+    # $1: date subdirectory
+    # $2: filename
+    if test -z "$2" || test -n "$3"; then
+        echo >&2 "Bad programming"
+        exit 1
+    fi
+    local subdir=$1
+    local file=$2
+    local dest=$BACKUPDIR/$subdir/$file
+    tee $dest > /dev/null
+}
+
+move_over $@