aboutsummaryrefslogtreecommitdiff
path: root/scripts/upgrade
diff options
context:
space:
mode:
authorFélix Piédallu <felix@piedallu.me>2024-05-27 12:28:33 +0200
committerFélix Piédallu <felix@piedallu.me>2024-05-27 12:56:43 +0200
commitf50a6703097e15472264cc4f48346763edb2bc1b (patch)
tree6a5ca7eb5d3fcd84b305854c84eea14eee1c2663 /scripts/upgrade
parent07c74254f05cd4f5ae2140bdd9e317f1eeb25c7a (diff)
downloadmastodon_ynh-f50a6703097e15472264cc4f48346763edb2bc1b.tar.gz
mastodon_ynh-f50a6703097e15472264cc4f48346763edb2bc1b.tar.bz2
mastodon_ynh-f50a6703097e15472264cc4f48346763edb2bc1b.zip
Try to fix systemd services handling in upgrade script
Diffstat (limited to 'scripts/upgrade')
-rw-r--r--scripts/upgrade15
1 files 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"