From f50a6703097e15472264cc4f48346763edb2bc1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 27 May 2024 12:28:33 +0200 Subject: [PATCH] Try to fix systemd services handling in upgrade script --- scripts/upgrade | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 421ddb2..a285ff2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -34,9 +34,16 @@ ynh_remove_extra_repo #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=${app}-web --action="stop" --log_path=/var/log/$app/$app-web.log --line_match="Goodbye" -ynh_systemd_action --service_name=${app}-sidekiq --action="stop" --log_path=/var/log/$app/$app-sidekiq.log --line_match="Bye" -ynh_systemd_action --service_name=${app}-streaming --action="stop" --log_path=/var/log/$app/$app-streaming.log --line_match="exiting" +if ynh_compare_current_package_version --comparison lt --version "4.2.8~ynh2"; then + # Workaround for pre-packagingv2 versions + ynh_systemd_action --service_name=${app}-web --action="stop" --log_path="systemd" --line_match="Goodbye" + ynh_systemd_action --service_name=${app}-sidekiq --action="stop" --log_path="systemd" --line_match="Bye" + ynh_systemd_action --service_name=${app}-streaming --action="stop" --log_path="systemd" --line_match="exiting" +else + ynh_systemd_action --service_name=${app}-web --action="stop" --log_path=/var/log/$app/$app-web.log --line_match="Goodbye" + ynh_systemd_action --service_name=${app}-sidekiq --action="stop" --log_path=/var/log/$app/$app-sidekiq.log --line_match="Bye" + ynh_systemd_action --service_name=${app}-streaming --action="stop" --log_path=/var/log/$app/$app-streaming.log --line_match="exiting" +fi #================================================= # ADD SWAP IF NEEDED @@ -156,7 +163,7 @@ popd #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=${app}-web --action="start" --log_path=/var/log/$app/$app-web.log --line_match="Listening on" +ynh_systemd_action --service_name=${app}-web --action="restart" --log_path=/var/log/$app/$app-web.log --line_match="Listening on" ynh_systemd_action --service_name=${app}-sidekiq --action="start" --log_path=/var/log/$app/$app-sidekiq.log --line_match="Schedules Loaded" ynh_systemd_action --service_name=${app}-streaming --action="start" --log_path=/var/log/$app/$app-streaming.log --line_match="Streaming API now listening"