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:
parent
327c55d587
commit
078d3c18b7
1 changed files with 55 additions and 17 deletions
|
@ -1,27 +1,65 @@
|
|||
#!/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
|
||||
|
||||
# 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
|
||||
|
||||
# Retrieve app settings
|
||||
domain=$(ynh_app_setting_get "$app" domain)
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
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}"
|
||||
ynh_backup "${final_path}" "sources" 1
|
||||
#=================================================
|
||||
# STANDARD BACKUP STEPS
|
||||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
||||
# Copy the nginx conf files
|
||||
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf"
|
||||
ynh_backup "$final_path"
|
||||
|
||||
# Copy the lstu conf file
|
||||
ynh_backup "${final_path}/lstu.conf" "lstu.conf"
|
||||
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"
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
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"
|
Loading…
Add table
Reference in a new issue