1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/redmine_ynh.git synced 2024-09-03 20:16:16 +02:00

Update backup

This commit is contained in:
liberodark 2019-03-22 15:48:42 +01:00 committed by GitHub
parent 602f2e9bc3
commit fd128e3af3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,33 +1,60 @@
#!/bin/bash #!/bin/bash
# Exit on command errors and treat unset variables as an error #=================================================
set -eu # GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# See comments in install script source _common.sh
app=$YNH_APP_INSTANCE_NAME
# Source YunoHost helpers
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
# Backup sources & data #=================================================
# Note: the last argument is where to save this path, see the restore script. # MANAGE SCRIPT FAILURE
ynh_backup "/var/www/${app}" "sources" #=================================================
### MySQL (remove if not used) ### ynh_clean_setup () {
# If a MySQL database is used: ### Remove this function if there's nothing to clean before calling the remove script.
# # Dump the database true
# dbname=$app }
# dbuser=$app # Exit if an error occurs during the execution of the script
# dbpass=$(ynh_app_setting_get "$app" mysqlpwd) ynh_abort_if_errors
# mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql
### MySQL end ###
# Copy NGINX configuration #=================================================
domain=$(ynh_app_setting_get "$app" domain) # LOAD SETTINGS
ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf" #=================================================
### PHP (remove if not used) ### app=$YNH_APP_INSTANCE_NAME
# If a dedicated php-fpm process is used:
# # Copy PHP-FPM pool configuration final_path=$(ynh_app_setting_get $app final_path)
# ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf" domain=$(ynh_app_setting_get $app domain)
### PHP end ### db_name=$(ynh_app_setting_get $app psql_db)
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup "$final_path"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP THE PSQL DATABASE
#=================================================
ynh_psql_dump_db "$db_name" > db.sql
ynh_backup "db.sql"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP THE CRON FILE
#=================================================
ynh_backup "/etc/cron.d/$app"