2018-02-06 14:33:23 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-02-11 00:32:26 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
|
2018-02-06 14:33:23 +01:00
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
# Stop script if errors
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
|
|
|
# Import common cmd
|
|
|
|
source ../settings/scripts/experimental_helper.sh
|
|
|
|
source ../settings/scripts/_common.sh
|
|
|
|
|
2019-11-02 21:19:47 +01:00
|
|
|
ynh_script_progression --message="Loading installation settings..."
|
|
|
|
|
|
|
|
final_path=$(ynh_app_setting_get --app $app --key final_path)
|
|
|
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
|
|
|
db_name=$(ynh_app_setting_get --app $app --key db_name)
|
2018-02-06 14:33:23 +01:00
|
|
|
|
2018-02-11 00:32:26 +01:00
|
|
|
#=================================================
|
|
|
|
# STANDARD BACKUP STEPS
|
|
|
|
#=================================================
|
|
|
|
|
2018-02-06 14:33:23 +01:00
|
|
|
# BACKUP THE APP MAIN DIR
|
2019-11-02 21:19:47 +01:00
|
|
|
ynh_script_progression --message="Backing up code..." --weight=3
|
|
|
|
ynh_backup --src_path "$final_path"
|
2018-02-06 14:33:23 +01:00
|
|
|
|
|
|
|
# Backup user data
|
2019-11-02 21:19:47 +01:00
|
|
|
ynh_script_progression --message="Backing up user data..." --weight=10
|
|
|
|
ynh_backup --src_path "$gollem_data_dir"
|
2018-02-06 14:33:23 +01:00
|
|
|
|
|
|
|
# BACKUP THE NGINX CONFIGURATION
|
2019-11-02 21:19:47 +01:00
|
|
|
ynh_script_progression --message="Backing up configuration..."
|
|
|
|
ynh_backup --src_path "/etc/nginx/conf.d/$domain.d/$app.conf"
|
2018-02-06 14:33:23 +01:00
|
|
|
|
|
|
|
# BACKUP THE PHP-FPM CONFIGURATION
|
2019-11-02 21:19:47 +01:00
|
|
|
ynh_backup --src_path "/etc/php5/fpm/pool.d/$app.conf"
|
2018-02-06 14:33:23 +01:00
|
|
|
|
|
|
|
# BACKUP THE MYSQL DATABASE
|
2019-11-02 21:19:47 +01:00
|
|
|
ynh_script_progression --message="Backing up database"
|
|
|
|
ynh_mysql_dump_db "$db_name" > db.sql
|
|
|
|
|
|
|
|
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last
|