diff options
| author | yalh76 <yalh@yahoo.com> | 2019-05-12 20:32:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-12 20:32:49 +0200 |
| commit | f6bf3f01c9bbe6862cb8360e05245672e33963e5 (patch) | |
| tree | 0cf3ea06df3f1b5f6206d51518f805a481417117 /scripts/backup | |
| parent | 0e6fcf1700e12399fea0bf3ba0c91a71f0bec9cc (diff) | |
| parent | c857d70f73587852cacc608a4e140b5b6b2b9e87 (diff) | |
| download | mastodon_ynh-f6bf3f01c9bbe6862cb8360e05245672e33963e5.tar.gz mastodon_ynh-f6bf3f01c9bbe6862cb8360e05245672e33963e5.tar.bz2 mastodon_ynh-f6bf3f01c9bbe6862cb8360e05245672e33963e5.zip | |
Merge pull request #140 from YunoHost-Apps/example_ynh
Example ynh
Diffstat (limited to 'scripts/backup')
| -rw-r--r-- | scripts/backup | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/scripts/backup b/scripts/backup index 58b29a7..fdee95f 100644 --- a/scripts/backup +++ b/scripts/backup @@ -8,7 +8,6 @@ #Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh -source ../settings/scripts/ynh_systemd_action source /usr/share/yunohost/helpers #================================================= @@ -24,43 +23,43 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." --weight=2 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..." --weight=27 -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..." --weight=2 -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..." --weight=2 -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..." --weight=4 ynh_psql_dump_db "$db_name" > db.sql @@ -69,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..." --weight=2 -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..." --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 @@ -94,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)." --last |
