Improved Plan B scripts.

This commit is contained in:
Christian P. MOMON 2023-03-17 01:06:47 +01:00
parent d905389517
commit 6ebe7b8831
2 changed files with 10 additions and 9 deletions

10
Plan Borg/bin/dobackup-rsync Normal file → Executable file
View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash -x
help() help()
{ {
@ -17,14 +17,10 @@ fi
if (( $help )); then if (( $help )); then
help help
else else
MACHINE="$1" COMPUTER="$1"
REMOTE_USER=admin666 REMOTE_USER=admin666
echo "===== $COMPUTER =====" echo "===== $COMPUTER ====="
# rsync CONFIG="/etc/borgmatic.d/$COMPUTER.yaml"
rsync root@${COMPUTER} /var/backups/borg/mirrors/$COMPUTER --exclude
# Backup the rsync directory.
CONFIG="/etc/borgmatic.d/$COMPUTER.conf"
if [ -f "$CONFIG" ]; then if [ -f "$CONFIG" ]; then
borgmatic -c $CONFIG create $OPTIONS --stats --verbosity 1 --syslog-verbosity 1 borgmatic -c $CONFIG create $OPTIONS --stats --verbosity 1 --syslog-verbosity 1
fi fi

View File

@ -23,9 +23,14 @@ if (( $help )); then
else else
COMPUTER="$1" COMPUTER="$1"
# TODOOOOOOOOOOOOOOOOOOOOOOOOOO echo "== Create the mirroring directory."
mkdir /var/backups/borg/mirrors/${COMPUTER}
echo "== Create dedicated cache."
mkdir /var/backups/borg/mirrors/${COMPUTER}.cache
echo "== Create the borgmatic configuration file." echo "== Create the borgmatic configuration file."
cp /srv/borg/models/model-conf-remote.yaml /etc/borgmatic.d/${COMPUTER}.yaml cp /srv/borg/models/model-conf-rsync.yaml /etc/borgmatic.d/${COMPUTER}.yaml
echo "== Update the repository directory in borgmatic configuration file." echo "== Update the repository directory in borgmatic configuration file."
sed -i s/\<HOSTNAME\>/${COMPUTER}/g /etc/borgmatic.d/${COMPUTER}.yaml sed -i s/\<HOSTNAME\>/${COMPUTER}/g /etc/borgmatic.d/${COMPUTER}.yaml