Modèle de message (français)
Mon serveur YunoHost
Matériel: VPS acheté en ligne + Vieil ordinateur
Version de YunoHost: 11.2.30.1
J’ai accès à mon serveur : En SSH | Par la webadmin
Êtes-vous dans un contexte particulier ou avez-vous effectué des modifications particulières sur votre instance ? : non
Description du problème
Bonjour,
Quelques petits soucis lié aux dernières mises à jour des apps borg
et borgserver
…
Hier j’ai mis à jour sur un serveur distant (disons serveurA) 2 applications Borg Backup vers la version 1.4.0~ynh1
Je les utilises pour une sauvegarde distante vers un serveur auto-hébergé chez moi (disons serveurB) avec un app borgserver
à jour aussi depuis peu avec la version 1.2.8~ynh5
.
Je ne comprends pas pourquoi hier le backup distant, celui de l’application borgserver
a échoué, je viens de tenter de redémarrer systemctl start borg
, mais j’ai des erreurs… à chaque fois sur une application en particulier on dirait…
Ce matin l’e message d’erreur était
The backup miserably failed to backup nextcloud application.
après un essai de redémarrage
The backup miserably failed to backup etherpad_mypads application.
J’ai essayé de vérifier l’alerte au sujet du CVE… Mais là j’ai des trucs bizarre…
app=borg; sudo env BORG_RSH="ssh -i /root/.ssh/id_borg_ed25519 -p xxxx -oStrictHostKeyChecking=yes " BORG_PASSPHRASE="$(sudo yunohost app setting borg passphrase)" BORG_RELOCATED_REPO_ACCESS_IS_OK=yes BORG_REPO="$(sudo yunohost app setting borg repository)" /var/www/borg/venv/bin/borg upgrade --show-rc --check-tam $BORG_REPO
Failed to create/acquire the lock /mnt/disk/backup/lock.exclusive (timeout).
terminating with error status, rc 2
Du coup j’essaie
app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_borg_ed25519 -oStrictHostKeyChecking=yes " /var/www/${app}/venv/bin/borg break-lock "$(yunohost app setting $app repository)
mais toujours une erreur…
Est-ce que c’est du au path sur un disque monté ? en effet comme on voit sur le message, le path du repository sur le serveurB ou se trouve borgserver
est un lien symbolique
ls -ll /home/userborg/backup
lrwxrwxrwx 1 userborg userborg 16 6 janv. 2022 /home/userborg/backup -> /mnt/disk/backup
par contre j’ai bien un soucis de lock que suis arrivé une fois a enlever avec une commande
app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_borg_ed25519 -oStrictHostKeyChecking=yes " /var/www/${app}/venv/bin/borg break-lock "$(yunohost app setting $app repository)"
ls -ll /home/userborg/backup/
total 34144
-rw------- 1 userborg userborg 712 22 oct. 2022 config
drwx------ 131 userborg userborg 4096 8 sept. 04:28 data
-rw------- 1 userborg userborg 4626381 8 sept. 15:41 hints.128304
-rw------- 1 userborg userborg 30304298 8 sept. 15:41 index.128304
-rw------- 1 userborg userborg 190 8 sept. 15:41 integrity.128304
drwx------ 2 userborg userborg 4096 8 sept. 15:41 lock.exclusive
-rw------- 1 userborg userborg 58 8 sept. 15:41 lock.roster
-rw------- 1 userborg userborg 16 8 sept. 15:42 nonce
-rw------- 1 userborg userborg 73 22 oct. 2022 README
Maintenant j’ai de nouveau un message
The backup miserably failed to backup forgejo application.
et l’erreur log à la fin (les autres failed aussi)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Source path '/root/.ssh/id_borg__2_ed25519' does not exist
Source path '/root/.ssh/id_borg__2_ed25519.pub' does not exist
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Could not run script: /etc/yunohost/hooks.d/backup_method/05-borg_app
Custom backup method could not get past the 'backup' step
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_applying_method_custom': 'Calling the custom backup method '{method}'…' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translated string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}, raising error: KeyError('method') (don't panic this is just a warning)
Failed to format translatable string 'backup_method_custom_finished': 'Custom backup method '{method}' finished' with arguments '()' and '{}', raising error: KeyError('method') (don't panic this is just a warning)
Là j’ai un truc intéressant, c’est cette erreur Source path '/root/ssh/id_borg__2_ed25519' does not exist
…
L’embrouille est que l’autre sauvegarde locale de Borg Backup borg__2
n’a pas de clé ssh. Pourtant dans les settings elle prend le même passphrase
root@serveurA:~# yunohost app setting borg passphrase
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsame
root@serveurA:~# yunohost app setting borg__2 passphrase
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxsame
Quand je veux lire le dépôt de cette sauvegarde locale, je peux utiliser BORG_PASSPHRASE="$(yunohost app setting $app passphrase)"
par contre pour la clé ssh je dois utiliser celle de borg
BORG_RSH="ssh -i /root/.ssh/id_borg_ed25519 -oStrictHostKeyChecking=yes "
car borg__2
n’a pas de clé ssh…
/etc/yunohost/hooks.d/backup_method/05-borg_app (mise à jour 2024)
#!/usr/bin/env bash
set -Eeuo pipefail
borg="/var/www/borg/venv/bin/borg"
app="borg"
BORG_PASSPHRASE="$(yunohost app setting "$app" passphrase)"
BORG_REPO="$(yunohost app setting "$app" repository)"
BORG_LOGGING_CONF="/var/www/borg/logging.conf"
if ssh-keygen -F "[domainborgserver.tld]:xxxx" >/dev/null ; then
BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 -oStrictHostKeyChecking=yes "
else
BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 -oStrictHostKeyChecking=no "
fi
do_need_mount() {
true
}
do_backup() {
export BORG_PASSPHRASE
export BORG_REPO
export BORG_RSH
export BORG_LOGGING_CONF
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
work_dir="$1"
name="$2"
size="$3"
description="$4"
set +e
if ! "$borg" list > /dev/null 2>&1; then
"$borg" init -e repokey
# human_size=`echo $size | awk '{ suffix=" KMGT"; for(i=1; $1>1024 && i < length(suffix); i++) $1/=1024; print int($1) substr(suffix, i, 1), $3; }'`
# Speed in Kbps
# speed=1000
# evaluated_time=$(($size / ($speed * 1000 / 8) / 3600))
echo "Hello,
Your first backup on $BORG_REPO is starting.
This is an automated message from your beloved YunoHost server." | /usr/bin/mail.mailutils -a "Content-Type: text/plain; charset=UTF-8" -s "[YNH] First backup is starting" "root"
fi
set -e
# About the {now} placeholder:
# https://borgbackup.readthedocs.io/en/stable/usage/create.html#description
# In the archive name, you may use the following placeholders: {now}, {utcnow}, {fqdn}, {hostname}, {user} and some others.
"$borg" create --stats "::${name}-{now}" "$work_dir"
"$borg" prune --glob-archives "${name}-*" --list --keep-hourly 2 --keep-daily=7 --keep-weekly=8 --keep-monthly=12
# We prune potential manual backup older than 1 year
"$borg" prune --list --keep-within 1y
}
do_mount() {
export BORG_PASSPHRASE
export BORG_REPO
export BORG_RSH
export BORG_LOGGING_CONF
work_dir="$1"
name="$2"
size="$3"
description="$4"
"$borg" mount "::$name" "$work_dir"
}
work_dir="$2"
name="$3"
size="$5"
description="$6"
case "$1" in
need_mount)
do_need_mount "$work_dir" "$name" "$size" "$description"
;;
backup)
do_backup "$work_dir" "$name" "$size" "$description"
;;
mount)
do_mount "$work_dir" "$name" "$size" "$description"
;;
*)
echo "hook called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0
Fichier de configuration des sauvegardes locales
/etc/yunohost/hooks.d/backup_method/05-borg__2_app (mise à jour 2024)
#!/usr/bin/env bash
set -Eeuo pipefail
borg="/var/www/borg__2/venv/bin/borg"
app="borg__2"
BORG_PASSPHRASE="$(yunohost app setting "$app" passphrase)"
BORG_REPO="$(yunohost app setting "$app" repository)"
BORG_LOGGING_CONF="/var/www/borg__2/logging.conf"
if ssh-keygen -F "" >/dev/null ; then
BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 -oStrictHostKeyChecking=yes "
else
BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 -oStrictHostKeyChecking=no "
fi
do_need_mount() {
true
}
do_backup() {
export BORG_PASSPHRASE
export BORG_REPO
export BORG_RSH
export BORG_LOGGING_CONF
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
work_dir="$1"
name="$2"
size="$3"
description="$4"
set +e
if ! "$borg" list > /dev/null 2>&1; then
"$borg" init -e repokey
# human_size=`echo $size | awk '{ suffix=" KMGT"; for(i=1; $1>1024 && i < length(suffix); i++) $1/=1024; print int($1) substr(suffix, i, 1), $3; }'`
# Speed in Kbps
# speed=1000
# evaluated_time=$(($size / ($speed * 1000 / 8) / 3600))
echo "Hello,
Your first backup on $BORG_REPO is starting.
This is an automated message from your beloved YunoHost server." | /usr/bin/mail.mailutils -a "Content-Type: text/plain; charset=UTF-8" -s "[YNH] First backup is starting" "root"
fi
set -e
# About the {now} placeholder:
# https://borgbackup.readthedocs.io/en/stable/usage/create.html#description
# In the archive name, you may use the following placeholders: {now}, {utcnow}, {fqdn}, {hostname}, {user} and some others.
"$borg" create --stats "::${name}-{now}" "$work_dir"
"$borg" prune --glob-archives "${name}-*" --list --keep-hourly 2 --keep-daily=7 --keep-weekly=8 --keep-monthly=12
# We prune potential manual backup older than 1 year
"$borg" prune --list --keep-within 1y
}
do_mount() {
export BORG_PASSPHRASE
export BORG_REPO
export BORG_RSH
export BORG_LOGGING_CONF
work_dir="$1"
name="$2"
size="$3"
description="$4"
"$borg" mount "::$name" "$work_dir"
}
work_dir="$2"
name="$3"
size="$5"
description="$6"
case "$1" in
need_mount)
do_need_mount "$work_dir" "$name" "$size" "$description"
;;
backup)
do_backup "$work_dir" "$name" "$size" "$description"
;;
mount)
do_mount "$work_dir" "$name" "$size" "$description"
;;
*)
echo "hook called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0
Qu’est-ce que je dois faire ??
L’autre application Borg Backup borg__2
qui fait une sauvegarde locale, elle fonctionne…
Je recommence ainsi, sachant que le service est failed en lançant ces commandes
root@serveurA:~# app=borg; sudo env BORG_RSH="ssh -i /root/.ssh/id_borg_ed25519 -p xxxx -oStrictHostKeyChecking=yes " BORG_PASSPHRASE="$(sudo yunohost app setting borg passphrase)" BORG_RELOCATED_REPO_ACCESS_IS_OK=yes BORG_REPO="$(sudo yunohost app setting borg repository)" /var/www/borg/venv/bin/borg upgrade --show-rc --check-tam $BORG_REPO
Manifest authentication setup OK for this client and this repository.
terminating with success status, rc 0
root@serveurA:~# app=borg; BORG_PASSPHRASE="$(yunohost app setting $app passphrase)" BORG_RSH="ssh -i /root/.ssh/id_borg_ed25519 -oStrictHostKeyChecking=yes " /var/www/${app}/venv/bin/borg break-lock "$(yunohost app setting $app repository)"
et je relance par espoir…
systemctl start borg
Mais je pense que je vais encore avoir un failed…
Autre chose, je n’arrive pas depuis le serveurB avec borgserver
a utiliser les commandes borg… Comment doit-on procéder ? Utiliser le shell de l’app ? l’user borguser ??