nsbin/sync-from
Nico Schottelius 899979d3ba handle sparse files correctly
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
2013-12-21 09:25:53 +01:00

35 lines
710 B
Bash
Executable file

#!/bin/sh -e
################################################################################
# standard vars stolen from cconf
__pwd="$(pwd -P)"
__mydir="${0%/*}"; __abs_mydir="$(cd "$__mydir" && pwd -P)"
__myname=${0##*/}; __abs_myname="$__abs_mydir/$__myname"
if [ $# -ne 2 ]; then
echo "$0: src dst"
exit 1
fi
from=$1; shift
dst=$1; shift
case $from in
loch)
src=root@loch:/home/services/backup/bento-manuell/
;;
42)
src=root@42:/home/services/backup/bento/
;;
esac
sshdir=$(cd "$__abs_mydir/../.ssh" && pwd -P)
sshkey=$sshdir/id_rsa
sshconfig=$sshdir/config
d1=$(date)
set -x
rsync -avS -e "ssh -i $sshkey -F $sshconfig" --delete "$src" "$dst"
echo $d1
date