diff options
Diffstat (limited to 'scripts/backup')
| -rw-r--r-- | scripts/backup | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/scripts/backup b/scripts/backup index 61ad5f4..c1d4f6f 100644 --- a/scripts/backup +++ b/scripts/backup @@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= -ynh_script_progression --message="Managing script failure..." --weight=1 ynh_clean_setup () { ynh_clean_check_starting @@ -24,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=2 +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -33,43 +32,27 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= -# STANDARD BACKUP STEPS +# DECLARE DATA AND CONF FILES TO BACKUP #================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=27 - -ynh_systemd_action --service_name=${app}-web --action="stop" --log_path=systemd --line_match="Stopped" -ynh_systemd_action --service_name=${app}-sidekiq --action="stop" --log_path=systemd --line_match="Stopped" -ynh_systemd_action --service_name=${app}-streaming --action="stop" --log_path=systemd --line_match="Stopped" +ynh_print_info --message="Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_script_progression --message="Backing up the main app directory..." --weight=2 ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Backing up nginx web server configuration..." --weight=2 ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= -# BACKUP THE POSTGRESQL DATABASE -#================================================= -ynh_script_progression --message="Backing up the PostgreSQL database..." --weight=4 - -ynh_psql_dump_db --database="$db_name" > db.sql - -#================================================= # SPECIFIC BACKUP #================================================= # BACKUP SYSTEMD #================================================= -ynh_script_progression --message="Backing up systemd configuration..." --weight=2 ynh_backup --src_path="/etc/systemd/system/$app-web.service" ynh_backup --src_path="/etc/systemd/system/$app-sidekiq.service" @@ -78,21 +61,18 @@ ynh_backup --src_path="/etc/systemd/system/$app-streaming.service" #================================================= # BACKUP A CRON FILE #================================================= -ynh_script_progression --message="Backing up a cron file..." --weight=1 ynh_backup --src_path="/etc/cron.d/$app" #================================================= -# START SYSTEMD SERVICE +# BACKUP THE POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_print_info --message="Backing up the PostgreSQL database..." -ynh_systemd_action --action=start --service_name=${app}-web --line_match="Listening on tcp" --log_path=systemd -ynh_systemd_action --action=start --service_name=${app}-sidekiq --line_match="Starting processing" --log_path=systemd -ynh_systemd_action --action=start --service_name=${app}-streaming --line_match="Worker 1 now listening" --log_path=systemd +ynh_psql_dump_db --database="$db_name" > db.sql #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." |
