mirror of
https://github.com/YunoHost-Apps/borg_ynh.git
synced 2024-09-03 18:16:05 +02:00
commit
552a565839
6 changed files with 24 additions and 10 deletions
|
@ -222,3 +222,6 @@ Then you can set up multiple instances of the Borg Apps on same servers.
|
|||
For instance:
|
||||
* Borg Backup instance ``borg``: backup nextcloud daily on host Server B
|
||||
* Borg Backup instance ``borg__2``: backup all other YunoHost apps weekly on host Server C
|
||||
|
||||
### Settings location
|
||||
Settings of apps are in /etc/yunohost/apps/*/settings.yml, so are the settings for borg_ynh as well. Be careful though to not savagely manually edit them if you don't know what you're doing.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -eo pipefail
|
||||
app="${0#"./05-"}"
|
||||
app="${app%"_app"}"
|
||||
|
||||
|
@ -30,7 +30,7 @@ do_backup() {
|
|||
repo="$3"
|
||||
size="$4"
|
||||
description="$5"
|
||||
current_date=$(date +"%d_%m_%y_%H:%M")
|
||||
current_date=$(date +"%Y-%m-%d_%H:%M")
|
||||
pushd "$work_dir"
|
||||
set +e
|
||||
if borg init -e repokey "$repo" ; then
|
||||
|
@ -46,12 +46,18 @@ This is an automated message from your beloved YunoHost server." | /usr/bin/mail
|
|||
fi
|
||||
set -e
|
||||
|
||||
borg create "$repo::${name}_${current_date}" ./ 2>&1 >/dev/null | log_with_timestamp
|
||||
borg create "$repo::_${name}-${current_date}" ./ 2>&1 >/dev/null | log_with_timestamp
|
||||
popd
|
||||
|
||||
# About thi _20 it's a crazy fix to avoid pruning wordpress__2
|
||||
# if you prune wordpress
|
||||
borg prune "$repo" -P ${name}_20 --keep-hourly 2 --keep-daily=7 --keep-weekly=8 --keep-monthly=12 2>&1 >/dev/null | log_with_timestamp
|
||||
borg prune "$repo" -P "_${name}-" --keep-hourly 2 --keep-daily=7 --keep-weekly=8 --keep-monthly=12 2>&1 >/dev/null | log_with_timestamp
|
||||
|
||||
# Prune legacy archive name without error on wordpress/wordpress__2
|
||||
borg prune "$repo" -P "${name}_" --keep-within 2m --keep-monthly=12 2>&1 >/dev/null | log_with_timestamp
|
||||
|
||||
# We prune potential manual backup older than 1 year
|
||||
borg prune "$repo" --keep-within 1y 2>&1 >/dev/null | log_with_timestamp
|
||||
}
|
||||
|
||||
do_mount() {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Backup your server on a host server using Borg.",
|
||||
"fr": "Sauvegardez votre serveur sur un serveur distant avec Borg."
|
||||
},
|
||||
"version": "1.1.16~ynh17",
|
||||
"version": "1.1.16~ynh19",
|
||||
"url": "https://borgbackup.readthedocs.io",
|
||||
"license": "BSD-3-Clause",
|
||||
"maintainer": {
|
||||
|
@ -15,7 +15,7 @@
|
|||
"url": "https://reflexlibre.net"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 3.8.1"
|
||||
"yunohost": ">= 4.1.0"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [],
|
||||
|
@ -29,7 +29,7 @@
|
|||
"fr": "Dans quel repo borg souhaitez-vous sauvegarder vos fichiers ?"
|
||||
},
|
||||
"help":{
|
||||
"en": "Specify a remote repository using this format: ssh://USER@DOMAIN.TLD:PORT/~/backup . 'USER' is *not* meant to be an existing user on the guest server. Instead, it will be created *on the host server* during the installation of the Borg Server App. It's also possible to use a local repository using a syntax such as /mount/my_external_harddrive/backups"
|
||||
"en": "Specify a local repository like /mount/my_external_harddrive/backups or a remote repository using this format: ssh://USER@DOMAIN.TLD:PORT/~/backup . If you plan to use borgserver_ynh app : 'USER' is *not* meant to be an existing user on the guest server, instead, it will be created *on the host server* during the installation of the Borg Server App. With borgserver_ynh apps you can't specify another repo path than ~/backup."
|
||||
},
|
||||
"example": "ssh://john@serverb.tld:22/~/backup"
|
||||
},
|
||||
|
|
|
@ -135,7 +135,8 @@ systemctl start $app.timer
|
|||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --description="Deduplicating backup program"
|
||||
# Inactive services are ignored cause it's a timer
|
||||
yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show $app.service -p ActiveState --value | grep -v failed"
|
||||
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -75,7 +75,9 @@ systemctl enable $app.service --quiet
|
|||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --description="Deduplicating backup program"
|
||||
# Inactive services are ignored cause it's a timer
|
||||
yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show $app.service -p ActiveState --value | grep -v failed"
|
||||
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -141,7 +141,9 @@ chmod u+w /var/log/${app}
|
|||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --description="Deduplicating backup program"
|
||||
# Inactive services are ignored cause it's a timer
|
||||
yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show $app.service -p ActiveState --value | grep -v failed"
|
||||
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
Loading…
Add table
Reference in a new issue