33 lines
697 B
Plaintext
33 lines
697 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
help()
|
||
|
{
|
||
|
echo "Usage: dobackup-rsync [ -h | -help | --help | <MACHINE> ]"
|
||
|
echo "Rsync remote before backup it."
|
||
|
}
|
||
|
|
||
|
#
|
||
|
help=0
|
||
|
if (( $# != 1)); then
|
||
|
help=1
|
||
|
elif [ "$parameter" == "-h" ] || [ "$parameter" == "-help" ] || [ "$parameter" == "--help" ]; then
|
||
|
help=1
|
||
|
fi
|
||
|
|
||
|
if (( $help )); then
|
||
|
help
|
||
|
else
|
||
|
MACHINE="$1"
|
||
|
REMOTE_USER=admin666
|
||
|
echo "===== $COMPUTER ====="
|
||
|
# rsync
|
||
|
rsync root@${COMPUTER} /var/backups/borg/mirrors/$COMPUTER --exclude
|
||
|
|
||
|
# Backup the rsync directory.
|
||
|
CONFIG="/etc/borgmatic.d/$COMPUTER.conf"
|
||
|
if [ -f "$CONFIG" ]; then
|
||
|
borgmatic -c $CONFIG create $OPTIONS --stats --verbosity 1 --syslog-verbosity 1
|
||
|
fi
|
||
|
fi
|
||
|
|