2023-01-16 19:44:21 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
help()
|
|
|
|
{
|
|
|
|
echo "Usage: dobackup-remote [ -h | -help | --help | <COMPUTER> ]"
|
|
|
|
echo "Trigger backup on remote machine."
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
help=0
|
|
|
|
if (( $# != 1)); then
|
|
|
|
help=1
|
|
|
|
elif [ "$parameter" == "-h" ] || [ "$parameter" == "-help" ] || [ "$parameter" == "--help" ]; then
|
|
|
|
help=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if (( $help )); then
|
|
|
|
help
|
|
|
|
else
|
|
|
|
COMPUTER="$1"
|
|
|
|
echo "===== $COMPUTER ====="
|
|
|
|
|
|
|
|
# Fix repo owner.
|
|
|
|
BORG_REPO="/var/backups/borg/${COMPUTER}.repo"
|
|
|
|
chown -R borg.borg $BORG_REPO
|
|
|
|
|
|
|
|
# Trigger remote backup.
|
|
|
|
REMOTE_USER="admin666"
|
2023-01-17 18:15:43 +01:00
|
|
|
ssh ${REMOTE_USER}@${COMPUTER} "sudo borgmatic create $OPTIONS --stats --verbosity 1 --syslog-verbosity 1"
|
2023-01-16 19:44:21 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
|