1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/restic_ynh.git synced 2024-09-03 20:16:22 +02:00

fix: backup-restore

This commit is contained in:
Lionel Coupouchetty-Ramouchetty 2021-03-07 14:03:37 +01:00
parent 6a3580234d
commit 442d50b635
3 changed files with 24 additions and 15 deletions

View file

@ -6,7 +6,7 @@
"en": "Backup your server with restic.",
"fr": "Sauvegardez votre serveur avec restic."
},
"version": "0.12.0~ynh2",
"version": "0.12.0~ynh3",
"url": "https://restic.net/",
"license": "BSD-2-Clause",
"maintainer": {

View file

@ -19,12 +19,24 @@ ynh_abort_if_errors
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
export app=$YNH_APP_INSTANCE_NAME
export final_path="/opt/yunohost/${app}"
#=================================================
# BACKUP FILES
#=================================================
ynh_backup "/usr/local/bin/backup-with-$app"
ynh_backup "/etc/systemd/system/$app.service"
ynh_backup "/etc/systemd/system/$app.timer"
ynh_backup "/etc/systemd/system/${app}_check.service"
ynh_backup "/etc/systemd/system/${app}_check.timer"
ynh_backup "/etc/systemd/system/${app}_check_read_data.service"
ynh_backup "/etc/systemd/system/${app}_check_read_data.timer"
ynh_backup "/etc/yunohost/hooks.d/backup_method/05-${app}_app"
ynh_backup "${final_path}/check_method_${app}"
ynh_backup "${final_path}/restic_log_${app}"
ynh_backup "/root/.ssh/id_${app}_ed25519"
ynh_backup "/root/.ssh/id_${app}_ed25519.pub"
ynh_backup "/root/.ssh/config"

View file

@ -20,9 +20,11 @@ ynh_abort_if_errors
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
export app=$YNH_APP_INSTANCE_NAME
server=$(ynh_app_setting_get $app server)
export server=$(ynh_app_setting_get $app server)
export final_path="/opt/yunohost/${app}"
#=================================================
# INSTALL RESTIC
@ -43,14 +45,9 @@ ynh_restore
#=================================================
# ENABLE TIMER
#=================================================
systemctl --quiet enable $app.timer
systemctl start $app.timer
#yunohost service add $app.timer
#yunohost service enable $app.timer
#yunohost service start $app.timer
#=================================================
# RESTORE SYSTEMD
#=================================================
systemctl --quiet enable $app.service
systemctl enable --quiet ${app}.timer
systemctl enable --quiet ${app}_check.timer
systemctl enable --quiet ${app}_check_read_data.timer
systemctl start ${app}.timer
systemctl start ${app}_check.timer
systemctl start ${app}_check_read_data.timer