1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/garradin_ynh.git synced 2024-09-03 18:36:17 +02:00

Update backup

This commit is contained in:
frju365 2018-03-24 01:29:14 +01:00 committed by GitHub
parent afed033eeb
commit a588fe461f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,28 +1,56 @@
#!/bin/bash #!/bin/bash
set -eu #=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
# Source app helpers if [ ! -e _common.sh ]; then
# Get the _common.sh file if it's not in the current directory
cp ../settings/scripts/_common.sh ./_common.sh
chmod a+rx _common.sh
fi
source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
# This is a multi-instance app, meaning it can be installed several times independently #=================================================
# The id of the app as stated in the manifest is available as $YNH_APP_ID # MANAGE SCRIPT FAILURE
# The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...) #=================================================
# The app instance name is available as $YNH_APP_INSTANCE_NAME
# - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample # Exit if an error occurs during the execution of the script
# - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2 ynh_abort_if_errors
# - ynhexample__{N} for the subsequent installations, with N=3,4, ...
# The app instance name is probably what you are interested the most, since this is #=================================================
# guaranteed to be unique. This is a good unique identifier to define installation path, # LOAD SETTINGS
# db names, ... #=================================================
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
# Source YunoHost helpers final_path=$(ynh_app_setting_get $app final_path)
source /usr/share/yunohost/helpers
# Retrieve arguments
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get $app domain)
#=================================================
# 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 PHP-FPM CONFIGURATION
#=================================================
ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini"
# Backup directory location for the app from where the script is executed and # Backup directory location for the app from where the script is executed and
# which will be compressed afterward # which will be compressed afterward
backup_dir=$YNH_APP_BACKUP_DIR backup_dir=$YNH_APP_BACKUP_DIR