Page MenuHomePhabricator
Paste P311

(An Untitled Masterwork)
ActivePublic

Authored by raster on Jul 11 2019, 4:24 AM.
#!/bin/sh
if [ $# -lt 1 ]; then
echo "fsync usage:"
echo "fsync machine.name.to.sync.to"
exit
fi
MACHINE=$1
SYNC_PATH=`cat ~/.zsh/sync_files | awk '{printf("%s ", $1);}' | sed 's:~:'$HOME':g'`
TARGET_EXCLUDE=`ssh $MACHINE cat ~/.sync-exclude | awk '{printf("%s ", $1);}' | sed 's:~:'$HOME':g'`
LOCAL_EXCLUDE=`cat ~/.sync-exclude | awk '{printf("%s ", $1);}' | sed 's:~:'$HOME':g'`
FILES=""
for I in $SYNC_PATH; do
EXCLUDED=""
for J in $TARGET_EXCLUDE $LOCAL_EXCLUDE; do
if test "$I" = "$J"; then
echo "EXCLUDE: $I"
EXCLUDED="yes"
fi
done
if test -z "$EXCLUDED"; then
FILES="$FILES $I"
fi
done
OPTIONS='-avzz --bwlimit=50000 -R --stats -T '$HOME'/.tmp --progress -h --partial --delete --delete-excluded --exclude-from '$HOME/.zsh/sync_exclude' -e ssh'
SYNC="rsync"
BASE=$HOME
cd $BASE
ionice -c3 nice -n19 $SYNC $OPTIONS $FILES $MACHINE:$BASE
raster created this paste.Jul 11 2019, 4:24 AM
raster changed the visibility from "All Users" to "Public (No Login Required)".