1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/libreerp_ynh.git synced 2024-09-03 19:36:13 +02:00
libreerp_ynh/scripts/backup

31 lines
750 B
Text
Raw Normal View History

2016-11-29 00:20:02 +01:00
#!/bin/bash
2016-07-05 15:22:12 +02:00
# Exit on command errors and treat unset variables as an error
set -eu
2017-05-18 23:28:18 +02:00
source /usr/share/yunohost/helpers
#source _future.sh
source ../settings/scripts/_common.sh
2016-07-05 15:22:12 +02:00
app=$YNH_APP_INSTANCE_NAME
2017-05-18 23:28:18 +02:00
domain=$(ynh_app_setting_get "$app" domain)
2018-12-14 03:36:58 +01:00
final_path=$(ynh_app_setting_get "$app" final_path)
2018-12-14 19:48:42 +01:00
conf_file=$(ynh_app_setting_get "$app" conf_file)
2016-07-05 15:22:12 +02:00
# Backup sources & data
2018-12-14 03:36:58 +01:00
ynh_backup "${final_path}/$APPNAME"
ynh_backup "${final_path}/custom-addons"
ynh_backup "${final_path}/.local"
2017-05-18 23:28:18 +02:00
# Backup configuration
2018-12-14 03:36:58 +01:00
ynh_backup "$conf_file"
2016-07-05 15:22:12 +02:00
# Copy NGINX configuration
2018-12-14 03:36:58 +01:00
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf"
2017-05-18 23:28:18 +02:00
# Backup services
ynh_backup "/etc/systemd/system/${app}.service"
2016-07-05 15:22:12 +02:00
# Copy database
2018-12-14 03:36:58 +01:00
sudo su -c "pg_dump $app" postgres > ./dump.sql