diff --git a/scripts/backup b/scripts/backup index 1b668a4..85ecaad 100755 --- a/scripts/backup +++ b/scripts/backup @@ -6,21 +6,17 @@ # IMPORT GENERIC 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 - cp ../settings/scripts/psql.sh ./psql.sh - chmod a+rx _common.sh psql.sh -fi - -source _common.sh +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -source psql.sh #================================================= # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ### Remove this function if there's nothing to clean before calling the remove script. + true +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -30,8 +26,8 @@ ynh_abort_if_errors app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get "$app" final_path) -domain=$(ynh_app_setting_get "$app" domain) +final_path=$(ynh_app_setting_get $app final_path) +domain=$(ynh_app_setting_get $app domain) db_name=$(ynh_app_setting_get "$app" psql_db) cache=$(ynh_app_setting_get "$app" cache) @@ -58,7 +54,13 @@ then fi #================================================= -# BACKUP THE PostgreSQL DATABASE +# BACKUP THE PHP-FPM CONFIGURATION +#================================================= + +#ynh_backup "/etc/php5/fpm/pool.d/$app.conf" + +#================================================= +# BACKUP THE POSTGRESQL DATABASE #================================================= ynh_psql_dump_db "$db_name" > db.sql @@ -66,12 +68,25 @@ ynh_backup "db.sql" #================================================= # SPECIFIC BACKUP +#================================================= +# BACKUP LOGROTATE +#================================================= + +ynh_backup "/etc/logrotate.d/$app" + #================================================= # BACKUP SYSTEMD #================================================= ynh_backup "/etc/systemd/system/$app.service" +#================================================= +# BACKUP A CRON FILE +#================================================= + +ynh_backup "/etc/cron.d/$app" + + #================================================= # RELOAD NGINX #=================================================