aboutsummaryrefslogtreecommitdiff
path: root/scripts/backup
diff options
context:
space:
mode:
authoryalh76 <yalh@yahoo.com>2019-05-22 17:17:00 +0200
committerGitHub <noreply@github.com>2019-05-22 17:17:00 +0200
commit0c16a9585b813cbea4c74c9a77be9035533423f7 (patch)
tree6d110997f1fde72dbe423da6f2a9abbabd1c4730 /scripts/backup
parent2987ccf8b3aa393dbef79b874dfe5839a0ee10da (diff)
parent5068fc86f1871c7c702d6dde81e156d7b428725a (diff)
downloadmastodon_ynh-0c16a9585b813cbea4c74c9a77be9035533423f7.tar.gz
mastodon_ynh-0c16a9585b813cbea4c74c9a77be9035533423f7.tar.bz2
mastodon_ynh-0c16a9585b813cbea4c74c9a77be9035533423f7.zip
Merge pull request #142 from YunoHost-Apps/testing
Upgrade
Diffstat (limited to 'scripts/backup')
-rw-r--r--scripts/backup51
1 files changed, 25 insertions, 26 deletions
diff --git a/scripts/backup b/scripts/backup
index 58b29a7..62ac387 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,67 +23,67 @@ 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
+ynh_psql_dump_db --database="$db_name" > db.sql
#=================================================
# SPECIFIC BACKUP
#=================================================
# 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