2017-08-17 15:17:13 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-03-11 13:48:33 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
2017-08-17 15:17:13 +02:00
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
if [ ! -e _common.sh ]; then
|
2018-03-11 13:48:33 +01:00
|
|
|
# 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
|
2017-08-17 15:17:13 +02:00
|
|
|
fi
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2018-03-11 13:48:33 +01:00
|
|
|
#=================================================
|
|
|
|
# MANAGE SCRIPT FAILURE
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Exit if an error occurs during the execution of the script
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
2017-08-17 15:17:13 +02:00
|
|
|
#=================================================
|
|
|
|
# LOAD SETTINGS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2018-03-11 13:48:33 +01:00
|
|
|
|
2017-08-17 15:17:13 +02:00
|
|
|
final_path=$(ynh_app_setting_get $app final_path)
|
2018-03-11 13:48:33 +01:00
|
|
|
domain=$(ynh_app_setting_get $app domain)
|
2017-08-17 15:17:13 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STANDARD BACKUP STEPS
|
|
|
|
#=================================================
|
2018-03-11 13:48:33 +01:00
|
|
|
# BACKUP THE MYSQL DATABASE
|
2017-08-17 15:17:13 +02:00
|
|
|
#=================================================
|
|
|
|
|
2018-03-11 13:48:33 +01:00
|
|
|
pushd $final_path
|
|
|
|
mkdir mongo_backup
|
|
|
|
pushd mongo_backup
|
|
|
|
mongodump
|
|
|
|
popd
|
|
|
|
popd
|
2017-08-17 15:17:13 +02:00
|
|
|
|
|
|
|
#=================================================
|
2018-03-11 13:48:33 +01:00
|
|
|
# BACKUP THE APP MAIN DIR
|
2017-08-17 15:17:13 +02:00
|
|
|
#=================================================
|
|
|
|
|
2018-03-11 13:48:33 +01:00
|
|
|
ynh_backup "$final_path"
|
2017-08-17 15:17:13 +02:00
|
|
|
|
|
|
|
#=================================================
|
2018-03-11 13:48:33 +01:00
|
|
|
# BACKUP THE NGINX CONFIGURATION
|
2017-08-17 15:17:13 +02:00
|
|
|
#=================================================
|
2018-03-11 13:48:33 +01:00
|
|
|
|
|
|
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SPECIFIC BACKUP
|
|
|
|
#=================================================
|
|
|
|
# BACKUP LOGROTATE
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_backup "/etc/logrotate.d/$app"
|
2017-08-17 15:17:13 +02:00
|
|
|
|
|
|
|
#=================================================
|
2018-03-11 13:48:33 +01:00
|
|
|
# BACKUP SYSTEMD
|
2017-08-17 15:17:13 +02:00
|
|
|
#=================================================
|
|
|
|
|
2018-03-11 13:48:33 +01:00
|
|
|
ynh_backup "/etc/systemd/system/$app.service"
|