From c359400a27782923349f0a30a7a409fb63630b02 Mon Sep 17 00:00:00 2001 From: Plato Wu Date: Tue, 11 Apr 2017 16:05:40 +0800 Subject: [PATCH] remove --parents and implement this function for busybox --- bin/bitpocket | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/bitpocket b/bin/bitpocket index cae615f..3e6ce7d 100755 --- a/bin/bitpocket +++ b/bin/bitpocket @@ -198,11 +198,15 @@ function push() { exec 4>&- exec 3>&- + sleep 3 + if [ -s "$TMP_DIR/push-delete" ]; then - echo "$(<$TMP_DIR/push-delete) has been backup to $DOT_DIR/backups/$TIMESTAMP at remote" # Plato Wu,2017/02/04: copy -C change the default path tar -cf - "$TMP_DIR/push-delete" | $REMOTE_RUNNER "tar -C $REMOTE_PATH -xvf -" - $REMOTE_RUNNER "cd $REMOTE_PATH ; mkdir -p $DOT_DIR/backups/$TIMESTAMP ; xargs --arg-file=$TMP_DIR/push-delete cp --parents -p --reflink=auto --target-directory=$DOT_DIR/backups/$TIMESTAMP" + echo "$(<$TMP_DIR/push-delete) has been backup to remote $DOT_DIR/backups/$TIMESTAMP at remote" + # xargs --arg-file=$TMP_DIR/push-delete cp --parents -p --reflink=auto --target-directory=$DOT_DIR/backups/$TIMESTAMP + # cat $TMP_DIR/push-delete | xargs -I file cp -p --parents --reflink file $DOT_DIR/backups/$TIMESTAMP + $REMOTE_RUNNER "cd $REMOTE_PATH ; mkdir -p $DOT_DIR/backups/$TIMESTAMP ; cat $TMP_DIR/push-delete | while read file; do mkdir -p $DOT_DIR/backups/$TIMESTAMP/\`dirname \$file\`; cp \$file $DOT_DIR/backups/$TIMESTAMP/\`dirname \$file\`; done" # Plato Wu,2017/01/08: $() only works at local site # $REMOTE_RUNNER "cd $REMOTE_PATH ; find $DOT_DIR/backups/$TIMESTAMP -maxdepth 0 -empty -exec rmdir $DOT_DIR/backups/$TIMESTAMP \;" fi