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
60f9aba7b1
4 changed files with 49 additions and 36 deletions
|
@ -1,6 +1,6 @@
|
|||
# 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)
|
||||
[![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)
|
||||
|
@ -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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
* Schedule backup check
|
||||
* Remove expect message when question was not matched
|
||||
|
|
|
@ -1,36 +1,39 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
server="domain.tld:22"
|
||||
ssh_user="sam"
|
||||
passphrase="APassphrase"
|
||||
conf=1
|
||||
data=1
|
||||
app="all"
|
||||
on_calendar="Daily"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=0
|
||||
setup_root=0
|
||||
setup_nourl=1
|
||||
setup_private=0
|
||||
setup_public=0
|
||||
upgrade=1
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
incorrect_path=0
|
||||
port_already_use=0
|
||||
change_url=0
|
||||
; Manifest
|
||||
server="dst.domain.tld"
|
||||
ssh_user="sam"
|
||||
passphrase="APassphrase"
|
||||
conf=1
|
||||
port=2222
|
||||
backup_path=src.domain.tld
|
||||
data=1
|
||||
app="all"
|
||||
allow_extra_space_use=1
|
||||
on_calendar="Daily"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=0
|
||||
setup_root=0
|
||||
setup_nourl=1
|
||||
setup_private=0
|
||||
setup_public=0
|
||||
upgrade=1
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
incorrect_path=0
|
||||
port_already_use=0
|
||||
change_url=0
|
||||
;;; Levels
|
||||
Level 1=auto
|
||||
Level 2=auto
|
||||
Level 3=auto
|
||||
Level 4=na
|
||||
Level 5=auto
|
||||
Level 6=auto
|
||||
Level 7=auto
|
||||
Level 8=0
|
||||
Level 9=0
|
||||
Level 10=0
|
||||
Level 1=auto
|
||||
Level 2=auto
|
||||
Level 3=auto
|
||||
Level 4=na
|
||||
Level 5=auto
|
||||
Level 6=auto
|
||||
Level 7=auto
|
||||
Level 8=0
|
||||
Level 9=0
|
||||
Level 10=0
|
||||
;;; Options
|
||||
Email=restic-ynh@coupouchetty-ramouchetty.fr
|
||||
Notification=down
|
||||
|
|
|
@ -33,12 +33,18 @@ do_backup() {
|
|||
current_date=$(date +"%d_%m_%y_%H:%M")
|
||||
pushd $work_dir
|
||||
$RESTIC_COMMAND backup ./ >> $LOGFILE 2>> $ERRFILE
|
||||
return_code="$?"
|
||||
backup_return_code="$?"
|
||||
$RESTIC_COMMAND check >> $LOGFILE 2>> $ERRFILE
|
||||
check_return_code="$?"
|
||||
popd
|
||||
|
||||
# On ne nettoie que si la sauvegarde s'est bien passee
|
||||
if [ "$return_code" -eq "0" ];then
|
||||
$RESTIC_COMMAND forget --keep-daily 7 --keep-weekly 8 --keep-monthly 12 >> $LOGFILE 2>> $ERRFILE
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ After=network.target
|
|||
[Service]
|
||||
Type=oneshot
|
||||
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
|
||||
Group=root
|
||||
|
||||
|
|
Loading…
Reference in a new issue