hcoop-backup: Take file from stdin and split it.
[hcoop/scripts.git] / s3.common
index 51d3637..09d1e77 100644 (file)
--- a/s3.common
+++ b/s3.common
@@ -31,8 +31,9 @@ function s3_cmd () {
 }
 
 function move_over () {
 }
 
 function move_over () {
-    # Move file to its offsite destination
-    # $1: file, $2: relative directory (optional)
+    # Move file to its offsite destination.
+    # Expects the file to come from STDIN.
+    # $1: filename, $2: relative directory (optional)
     if test -z "$1" || test -n "$3"; then
         echo "Bad programming"
         exit 1
     if test -z "$1" || test -n "$3"; then
         echo "Bad programming"
         exit 1
@@ -42,12 +43,11 @@ function move_over () {
     if test -n "$2"; then
         DEST=$DEST/$2
     fi
     if test -n "$2"; then
         DEST=$DEST/$2
     fi
-    split -d -b ${CHUNKSIZE}m $FILE ${FILE}.
+    split -d -b ${CHUNKSIZE}m - ${FILE}.
     for i in ${FILE}.*; do
         s3_cmd put $DEST/$i $i
         rm -f $i
     done
     for i in ${FILE}.*; do
         s3_cmd put $DEST/$i $i
         rm -f $i
     done
-    rm -f $FILE
 }
 
 
 }