From 35e9c956f4996a47f237ba80b27085cb6135c562 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Wed, 9 Jun 2021 11:20:37 +0200 Subject: [PATCH] fix notify_app --- scripts/backup | 9 +++++++++ scripts/change_url | 16 +++++++--------- scripts/remove | 1 + scripts/restore | 7 ++++--- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/scripts/backup b/scripts/backup index da8f172..c94d43b 100755 --- a/scripts/backup +++ b/scripts/backup @@ -73,6 +73,15 @@ ynh_print_info --message="Backing up the MySQL database..." ynh_mysql_dump_db --database="$db_name" --default_character_set="utf8mb4" > db.sql +#================================================= +# BACKUP THE NOTIFY_PUSH APP +#================================================= + +if [ $use_notify_push -eq 1 ] +then + ynh_backup --src_path="/etc/systemd/system/${app}-notify-push.service" +fi + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index 71a661b..a9503d0 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -16,6 +16,8 @@ ynh_script_progression --message="Updating NGINX web server configuration..." -- ynh_change_url_nginx_config +ynh_change_url_nginx_config + #================================================= # SPECIFIC MODIFICATIONS #================================================= @@ -47,17 +49,13 @@ then sed --in-place --regexp-extended '/location = \/\.well\-known\/(caldav|carddav)/d' "/etc/nginx/conf.d/$new_domain.d/$app.conf" ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi -fi -#================================================= -# CONFIGURE NOTIFY_PUSH APP -#================================================= + if [ $enable_notify_push -eq 1 ] + then + ynh_add_systemd_config --service="${app}-notify-push" -if [ $use_notify_push -eq 1 ] -then - ynh_add_systemd_config --service="${app}-notify-push" - - ynh_systemd_action --service_name="${app}-notify-push" --action=restart + ynh_systemd_action --service_name="${app}-notify-push" --action=restart + fi fi #================================================= diff --git a/scripts/remove b/scripts/remove index 1bf74ab..bb67bd8 100755 --- a/scripts/remove +++ b/scripts/remove @@ -24,6 +24,7 @@ ynh_remove_fail2ban_config # Remove notify push ynh_remove_systemd_config --service="${app}-notify-push" +ynh_secure_remove --file="/var/run/$app/" # Remove a cron file # TODO: Ensure that cron job is not running (How !?) diff --git a/scripts/restore b/scripts/restore index 0641d44..0449612 100755 --- a/scripts/restore +++ b/scripts/restore @@ -75,7 +75,7 @@ ynh_script_progression --message="Restoring data directory..." --weight=2 ynh_restore_file --origin_path="$data_dir" --not_mandatory #================================================= -# CONFIGURE NOTIFY_PUSH APP +# RESTORE THE NOTIFY_PUSH APP #================================================= if [ $use_notify_push -eq 1 ] @@ -83,8 +83,9 @@ then mkdir -p /var/run/$app/ chown $app: /var/run/$app/ - ynh_add_systemd_config --service="${app}-notify-push" + ynh_restore_file --origin_path="/etc/systemd/system/${app}-notify-push.service" + systemctl enable $app.service --quiet ynh_systemd_action --service_name="${app}-notify-push" --action=restart fi @@ -150,7 +151,7 @@ ynh_systemd_action --service_name=nginx --action=reload # CHECK IF NOTIFY_PUSH WORKS #================================================= -if [ $use_notify_push -eq 1 ] +if [ $enable_notify_push -eq 1 ] then if ! ynh_exec_as "$app" nextcloud php7.3 $final_path/occ notify_push:self-test; then ynh_print_warn --message="High Performance Backend is not working correctly, try to repair it or contact YNH support."