26 lines
544 B
Bash
Executable File
26 lines
544 B
Bash
Executable File
#!/bin/bash -e
|
|
|
|
if [ $# -lt 3 ]; then
|
|
echo 'Usage: sync local_dir rsync_host rsync_dir'
|
|
exit 1
|
|
fi
|
|
|
|
umask 002
|
|
|
|
TO=/mirror/root/$1
|
|
RSYNC_HOST=$2
|
|
RSYNC_DIR=$3
|
|
ADDRESS=$(cat ~/config/ADDRESS_V6)
|
|
|
|
if test -n "$RSYNC_USER"; then
|
|
RSYNC_HOST=$RSYNC_USER@$RSYNC_HOST
|
|
fi
|
|
|
|
mkdir -p $TO
|
|
|
|
exec nice rsync -aH --no-owner --no-group --delete-after --delay-updates --safe-links \
|
|
--timeout=3600 -6 --address=$ADDRESS \
|
|
--exclude .~tmp~/ \
|
|
--quiet --stats --log-file=/home/mirror/merlin/logs/transfer.log \
|
|
$RSYNC_HOST::$RSYNC_DIR $TO
|