diff options
| author | yalh76 <yalh@yahoo.com> | 2019-05-10 16:34:57 +0200 |
|---|---|---|
| committer | yalh76 <yalh@yahoo.com> | 2019-05-10 16:34:57 +0200 |
| commit | ae5845526a964e0ab8161acf74b060f733191c5e (patch) | |
| tree | a035fb13e9d1b039593a4ea5ff1749ac8eef170f /scripts/backup | |
| parent | 629b59bc5357860b33417fe69eceb413185b68da (diff) | |
| download | mastodon_ynh-ae5845526a964e0ab8161acf74b060f733191c5e.tar.gz mastodon_ynh-ae5845526a964e0ab8161acf74b060f733191c5e.tar.bz2 mastodon_ynh-ae5845526a964e0ab8161acf74b060f733191c5e.zip | |
Apply example_ynh
Diffstat (limited to 'scripts/backup')
| -rw-r--r-- | scripts/backup | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/scripts/backup b/scripts/backup index ca9212d..ebf6361 100644 --- a/scripts/backup +++ b/scripts/backup @@ -23,43 +23,43 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." --time --weight=1 app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get $app final_path) -domain=$(ynh_app_setting_get $app domain) -db_name=$(ynh_app_setting_get $app db_name) +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) #================================================= -# STOP MASTODON SERVICES +# STANDARD BACKUP STEPS +#================================================= +# STOP SYSTEMD SERVICE #================================================= -ynh_print_info "Stopping Mastodon services..." +ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 -ynh_systemd_action --action=stop --service_name=${app}-web --line_match="Stopped" --log_path=systemd -ynh_systemd_action --action=stop --service_name=${app}-sidekiq --line_match="Stopped" --log_path=systemd -ynh_systemd_action --action=stop --service_name=${app}-streaming --line_match="Stopped" --log_path=systemd +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" #================================================= -# STANDARD BACKUP STEPS -#================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_print_info "Backing up the main app directory..." +ynh_script_progression --message="Backing up the main app directory..." --time --weight=1 -ynh_backup "$final_path" +ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_print_info "Backing up nginx web server configuration..." +ynh_script_progression --message="Backing up nginx web server configuration..." --time --weight=1 -ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE POSTGRESQL DATABASE #================================================= -ynh_print_info "Backing up the PostgreSQL database..." +ynh_script_progression --message="Backing up the PostgreSQL database..." --time --weight=1 ynh_psql_dump_db "$db_name" > db.sql @@ -68,22 +68,22 @@ ynh_psql_dump_db "$db_name" > db.sql #================================================= # BACKUP SYSTEMD #================================================= -ynh_print_info "Backing up systemd configuration..." +ynh_script_progression --message="Backing up systemd configuration..." --time --weight=1 -ynh_backup "/etc/systemd/system/$app-web.service" -ynh_backup "/etc/systemd/system/$app-sidekiq.service" -ynh_backup "/etc/systemd/system/$app-streaming.service" +ynh_backup --src_path="/etc/systemd/system/$app-web.service" +ynh_backup --src_path="/etc/systemd/system/$app-sidekiq.service" +ynh_backup --src_path="/etc/systemd/system/$app-streaming.service" #================================================= # BACKUP A CRON FILE #================================================= -ynh_backup "/etc/cron.d/$app" +ynh_backup --src_path="/etc/cron.d/$app" #================================================= -# START MASTODON SERVICES +# START SYSTEMD SERVICE #================================================= -ynh_print_info "Starting Mastodon services..." +ynh_script_progression --message="Starting a systemd service..." --time --weight=1 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 @@ -93,4 +93,4 @@ ynh_systemd_action --action=start --service_name=${app}-streaming --line_match=" # END OF SCRIPT #================================================= -ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last |
