1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nodebb_ynh.git synced 2024-09-03 19:46:29 +02:00

Update backup

This commit is contained in:
frju365 2018-03-11 13:48:33 +01:00 committed by GitHub
parent 372cfda874
commit ae39811059
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,50 +1,77 @@
#!/bin/bash #!/bin/bash
# Exit on command errors and treat unset variables as an error #=================================================
set -eu # GENERIC START
#================================================= #=================================================
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
if [ ! -e _common.sh ]; then if [ ! -e _common.sh ]; then
# Fetch helpers file if not in current directory # Get the _common.sh file if it's not in the current directory
sudo cp ../settings/scripts/_common.sh ./_common.sh cp ../settings/scripts/_common.sh ./_common.sh
sudo chmod a+rx _common.sh chmod a+rx _common.sh
fi fi
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get $app domain)
#================================================= #=================================================
# STANDARD BACKUP STEPS # STANDARD BACKUP STEPS
#================================================= #=================================================
# BACKUP APP MAIN DIR # BACKUP THE MYSQL DATABASE
#================================================= #=================================================
CHECK_SIZE "$final_path" pushd $final_path
ynh_backup "$final_path" "sources" mkdir mongo_backup
pushd mongo_backup
mongodump
popd
popd
#================================================= #=================================================
# BACKUP NGINX CONFIGURATION # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "nginx.conf" ynh_backup "$final_path"
#================================================= #=================================================
# BACKUP LOGROTATE CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_backup "/etc/logrotate.d/$app" "logrotate"
#=================================================
# BACKUP SYSTEMD CONFIGURATION
#================================================= #=================================================
ynh_backup "/etc/systemd/system/$app.service" "systemd.service" 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"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup "/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup "/etc/systemd/system/$app.service"