update sync scripts
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
parent
68572a49ba
commit
a4e1851ea7
2 changed files with 51 additions and 6 deletions
21
sync-from
21
sync-from
|
@ -6,21 +6,30 @@ __pwd="$(pwd -P)"
|
|||
__mydir="${0%/*}"; __abs_mydir="$(cd "$__mydir" && pwd -P)"
|
||||
__myname=${0##*/}; __abs_myname="$__abs_mydir/$__myname"
|
||||
|
||||
|
||||
src=root@loch:/home/services/backup/bento-manuell/
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "$0: $dst"
|
||||
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 -av -e "ssh -i $sshkey" --delete "$src" "$dst"
|
||||
rsync -av -e "ssh -i $sshkey -F $sshconfig" --delete "$src" "$dst"
|
||||
echo $d1
|
||||
date
|
||||
|
|
36
sync-to
Executable file
36
sync-to
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
~nico/bin/backup-marker
|
||||
|
||||
dsthost="$1"; shift
|
||||
case "$dsthost" in
|
||||
42)
|
||||
dst=42:/home/services/backup/bento
|
||||
;;
|
||||
loch)
|
||||
dst=root@loch:/home/services/backup/bento-manuell
|
||||
;;
|
||||
zuhause)
|
||||
dst=root@zuhause.schottelius.org:/home/services/backup/bento-manuell
|
||||
;;
|
||||
*)
|
||||
echo "Unknown $1" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
start=$(date)
|
||||
rsync -av --delete --progress \
|
||||
--exclude '/proc/*' \
|
||||
--exclude '/tmp/*' \
|
||||
--exclude '/sys/*' \
|
||||
--exclude '/dev/*' \
|
||||
--exclude '/home/users/nico/.bitcoin/blocks/' \
|
||||
--exclude '/home/users/nico/.bitcoin/chainstate/' \
|
||||
"$@" \
|
||||
/ "$dst"
|
||||
end=$(date)
|
||||
|
||||
echo $start
|
||||
echo $end
|
Loading…
Reference in a new issue