1
0
Fork 0
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:
Lionel Coupouchetty-Ramouchetty 2020-02-27 19:51:28 +01:00
commit 60f9aba7b1
4 changed files with 49 additions and 36 deletions

View file

@ -1,6 +1,6 @@
# restic for Yunohost # restic for Yunohost
[![Latest Version](https://img.shields.io/badge/version-1.0.3-green.svg?style=flat)](https://github.com/YunoHost-Apps/restic_ynh/releases) [![Latest Version](https://img.shields.io/badge/version-0.9.6-green.svg?style=flat)](https://github.com/YunoHost-Apps/restic_ynh/releases)
[![Status](https://img.shields.io/badge/status-testing-yellow.svg?style=flat)](https://github.com/YunoHost-Apps/restic_ynh/milestones) [![Status](https://img.shields.io/badge/status-testing-yellow.svg?style=flat)](https://github.com/YunoHost-Apps/restic_ynh/milestones)
[![Integration level](https://dash.yunohost.org/integration/restic.svg)](https://dash.yunohost.org/appci/app/restic) [![Integration level](https://dash.yunohost.org/integration/restic.svg)](https://dash.yunohost.org/appci/app/restic)
[![GitHub license](https://img.shields.io/badge/license-GPLv3-blue.svg?style=flat)](https://raw.githubusercontent.com/YunoHost-Apps/restic_ynh/master/LICENSE) [![GitHub license](https://img.shields.io/badge/license-GPLv3-blue.svg?style=flat)](https://raw.githubusercontent.com/YunoHost-Apps/restic_ynh/master/LICENSE)
@ -49,6 +49,10 @@ Sat *-*-1..7 18:00:00 : The first saturday of every month at 18:00
5,17:00 : Every day at 5 AM and at 5 PM 5,17:00 : Every day at 5 AM and at 5 PM
After each invocation an e-mail will be sent to root@yourdomain.tld with the execution log.
NOTE: After each backup, the repository integrity is checked
See here for more info : https://wiki.archlinux.org/index.php/Systemd/Timers#Realtime_timer See here for more info : https://wiki.archlinux.org/index.php/Systemd/Timers#Realtime_timer
At the end of the installation, the app displays the public_key and the user to give to the person who has access to the server B. At the end of the installation, the app displays the public_key and the user to give to the person who has access to the server B.
@ -113,5 +117,4 @@ You can setup the restic app several times on the same server so you can backup
## TODO ## TODO
* Schedule backup check
* Remove expect message when question was not matched * Remove expect message when question was not matched

View file

@ -1,11 +1,14 @@
;; Test complet ;; Test complet
; Manifest ; Manifest
server="domain.tld:22" server="dst.domain.tld"
ssh_user="sam" ssh_user="sam"
passphrase="APassphrase" passphrase="APassphrase"
conf=1 conf=1
port=2222
backup_path=src.domain.tld
data=1 data=1
app="all" app="all"
allow_extra_space_use=1
on_calendar="Daily" on_calendar="Daily"
; Checks ; Checks
pkg_linter=1 pkg_linter=1

View file

@ -33,12 +33,18 @@ do_backup() {
current_date=$(date +"%d_%m_%y_%H:%M") current_date=$(date +"%d_%m_%y_%H:%M")
pushd $work_dir pushd $work_dir
$RESTIC_COMMAND backup ./ >> $LOGFILE 2>> $ERRFILE $RESTIC_COMMAND backup ./ >> $LOGFILE 2>> $ERRFILE
return_code="$?" backup_return_code="$?"
$RESTIC_COMMAND check >> $LOGFILE 2>> $ERRFILE
check_return_code="$?"
popd popd
# On ne nettoie que si la sauvegarde s'est bien passee # On ne nettoie que si la sauvegarde s'est bien passee
if [ "$return_code" -eq "0" ];then if [ "$backup_return_code" -eq "0" ] && [ "$check_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 >> $LOGFILE 2>> $ERRFILE
else
[ "$backup_return_code" -ne 0 ] && echo "Something went wrong during backup" >> $ERRFILE
[ "$check_return_code" -ne 0 ] && echo "Repository check did not return 0" >> $ERRFILE
exit 1
fi fi
} }

View file

@ -5,6 +5,7 @@ After=network.target
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart=/usr/local/bin/backup-with-__APP__-answerbot ExecStart=/usr/local/bin/backup-with-__APP__-answerbot
ExecStartPost=/bin/bash -c 'echo -e "Subject: YunoHost Restic backup log on $(hostname)\n$(/bin/journalctl _SYSTEMD_INVOCATION_ID=`systemctl show -p InvocationID --value __APP__.service`)" | /usr/sbin/sendmail root'
User=root User=root
Group=root Group=root