libreerp_ynh/scripts/backup

32 lines
770 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
ynh_abort_if_errors
2017-05-18 23:28:18 +02:00
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
2022-02-13 19:55:00 +01:00
ynh_backup "${final_path}/$appname"
2018-12-14 03:36:58 +01:00
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