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
|
# restic for Yunohost
|
||||||
|
|
||||||
[](https://github.com/YunoHost-Apps/restic_ynh/releases)
|
[](https://github.com/YunoHost-Apps/restic_ynh/releases)
|
||||||
[](https://github.com/YunoHost-Apps/restic_ynh/milestones)
|
[](https://github.com/YunoHost-Apps/restic_ynh/milestones)
|
||||||
[](https://dash.yunohost.org/appci/app/restic)
|
[](https://dash.yunohost.org/appci/app/restic)
|
||||||
[](https://raw.githubusercontent.com/YunoHost-Apps/restic_ynh/master/LICENSE)
|
[](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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue