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

25 lines
639 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
# See comments in install script
app=$YNH_APP_INSTANCE_NAME
# Source YunoHost helpers
. /usr/share/yunohost/helpers
# Backup sources & data
ynh_backup "/usr/lib/python2.7/dist-packages/openerp/" "sources"
# Copy NGINX configuration
domain=$(ynh_app_setting_get "$app" domain)
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
ynh_backup "/etc/odoo/openerp-server.conf" "openerp-server.conf"
# Copy database
database=${domain//./-}
sudo su -c "pg_dump $database" postgres > ./dump.sql
pwd=`pwd`
ynh_backup "$pwd/dump.sql" "dump.sql"