mirror of
https://github.com/YunoHost-Apps/restic_ynh.git
synced 2024-09-03 20:16:22 +02:00
Merge branch 'testing'
This commit is contained in:
commit
5753e56062
4 changed files with 13 additions and 10 deletions
|
@ -8,7 +8,10 @@
|
|||
|
||||
[![Install restic with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=restic)
|
||||
|
||||
A restic package for YunoHost based on [the Borg package](https://github.com/YunoHost-Apps/borg_ynh/)
|
||||
A [restic](https://restic.net/) package for YunoHost (heavily inspired by [the Borg package](https://github.com/YunoHost-Apps/borg_ynh/)).
|
||||
|
||||
Restic is a backup tool that can make local and remote backups.
|
||||
This package uses restic to make backups to a sftp server.
|
||||
|
||||
## Usage
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ set -e
|
|||
RESTIC_PASSWORD="{{ passphrase }}"
|
||||
RESTIC_REPOSITORY_BASE=sftp:{{ server }}:{{ backup_path }}
|
||||
RESTIC_COMMAND=/usr/local/bin/restic
|
||||
LOGFILE=/var/log/restic_backup.log
|
||||
ERRFILE=/var/log/restic_backup.err
|
||||
|
||||
do_need_mount() {
|
||||
work_dir="$1"
|
||||
|
@ -16,7 +18,7 @@ do_need_mount() {
|
|||
export RESTIC_REPOSITORY=${RESTIC_REPOSITORY_BASE}/$name
|
||||
|
||||
# On essaie de lister les snapshots, sinon on initialise le depot
|
||||
$RESTIC_COMMAND list snapshots || $RESTIC_COMMAND init
|
||||
$RESTIC_COMMAND list snapshots > >(tee -a $LOGFILE) 2> >(tee -a $ERRFILE >&2) || $RESTIC_COMMAND init > >(tee -a $LOGFILE) 2> >(tee -a $ERRFILE >&2)
|
||||
}
|
||||
|
||||
do_backup() {
|
||||
|
@ -28,19 +30,17 @@ do_backup() {
|
|||
description="$5"
|
||||
export RESTIC_PASSWORD
|
||||
export RESTIC_REPOSITORY=${RESTIC_REPOSITORY_BASE}/$name
|
||||
LOGFILE=/var/log/restic_backup.log
|
||||
ERRFILE=/var/log/restic_backup.err
|
||||
current_date=$(date +"%d_%m_%y_%H:%M")
|
||||
pushd $work_dir
|
||||
$RESTIC_COMMAND backup ./ >> $LOGFILE 2>> $ERRFILE
|
||||
$RESTIC_COMMAND backup ./ > >(tee -a $LOGFILE) 2> >(tee -a $ERRFILE >&2)
|
||||
backup_return_code="$?"
|
||||
popd
|
||||
|
||||
# On ne nettoie que si la sauvegarde s'est bien passee
|
||||
if [ "$backup_return_code" -eq "0" ];then
|
||||
$RESTIC_COMMAND forget --keep-daily 7 --keep-weekly 8 --keep-monthly 12 >> $LOGFILE 2>> $ERRFILE
|
||||
$RESTIC_COMMAND forget --keep-daily 7 --keep-weekly 8 --keep-monthly 12 > >(tee -a $LOGFILE) 2> >(tee -a $ERRFILE >&2)
|
||||
else
|
||||
echo "Something went wrong during backup" >> $ERRFILE
|
||||
echo "Something went wrong during backup" > >(tee -a $ERRFILE >&2)
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -17,9 +17,9 @@ do_check() {
|
|||
current_date=$(date +"%d_%m_%y_%H:%M")
|
||||
echo -e "\n==============\n${current_date}\n==============\n" | tee -a ${LOGFILE} | tee -a ${ERRFILE}
|
||||
if [ "$check_read_data" -eq "1" ];then
|
||||
$RESTIC_COMMAND check --read-data >> $LOGFILE 2>> $ERRFILE
|
||||
$RESTIC_COMMAND check --read-data > >(tee -a $LOGFILE) 2> >(tee -a $ERRFILE >&2)
|
||||
else
|
||||
$RESTIC_COMMAND check >> $LOGFILE 2>> $ERRFILE
|
||||
$RESTIC_COMMAND check > >(tee -a $LOGFILE) 2> >(tee -a $ERRFILE >&2)
|
||||
fi
|
||||
check_return_code="$?"
|
||||
return "${check_return_code}"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Backup your server with restic.",
|
||||
"fr": "Sauvegardez votre serveur avec restic."
|
||||
},
|
||||
"version": "0.9.6~ynh2",
|
||||
"version": "0.9.6~ynh3",
|
||||
"url": "https://restic.net/",
|
||||
"license": "BSD 2-Clause \"Simplified\" License",
|
||||
"maintainer": {
|
||||
|
|
Loading…
Reference in a new issue