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

update backup

This commit is contained in:
Pierre Bourré 2019-02-03 01:03:43 +01:00
parent 327c55d587
commit 078d3c18b7

View file

@ -1,27 +1,65 @@
#!/bin/bash #!/bin/bash
# vim:set noexpandtab:
# Exit on command errors and treat unset variables as an error #=================================================
set -eu # GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Source app helpers source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
# Get multi-instances specific variables #=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
# Retrieve app settings final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get "$app" domain) domain=$(ynh_app_setting_get $app domain)
db_name=$(ynh_app_setting_get $app db_name)
# Copy the app files #=================================================
final_path="/var/www/${app}" # STANDARD BACKUP STEPS
ynh_backup "${final_path}" "sources" 1 #=================================================
# BACKUP THE APP MAIN DIR
#=================================================
# Copy the nginx conf files ynh_backup "$final_path"
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
# Copy the lstu conf file #=================================================
ynh_backup "${final_path}/lstu.conf" "lstu.conf" # BACKUP THE NGINX CONFIGURATION
ynh_backup "/etc/systemd/system/lstu.service" "systemd_lstu.service" #=================================================
ynh_backup "/etc/logrotate.d/${app}" "logrotate_lstu"
ynh_backup "/var/log/${app}/production.log" "production.log" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP THE POSTGRESQL DATABASE
#=================================================
ynh_psql_dump_db "$db_name" > db.sql
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup "/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup "/etc/systemd/system/$app.service"