diff --git a/scripts/_common.sh b/scripts/_common.sh index b806c2b..341ea2e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -10,12 +10,19 @@ pip_dependencies=( 'PyMySQL>=0.9,<1.1' ) -### Constants #================================================= # PERSONAL HELPERS #================================================= +wait_gunicorn_start() { + # line_match isn't enough because ihatemoney may stop if database upgrades + for _ in {1..20}; do + test -S /tmp/budget.gunicorn_$app.sock && break + sleep 1 + done +} + __ynh_python_venv_setup() { local -A args_array=( [d]=venv_dir= [p]=packages= ) local venv_dir diff --git a/scripts/change_url b/scripts/change_url index 855437d..c5a8367 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -52,6 +52,7 @@ ynh_script_progression --message="Starting a systemd service..." --weight=5 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" +wait_gunicorn_start #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 7a373da..500c6b6 100755 --- a/scripts/install +++ b/scripts/install @@ -92,12 +92,7 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --line_match="Listening at" - -# line_match isn't enough because ihatemoney may stop if database upgrades -for _ in {1..20}; do - test -S /tmp/budget.gunicorn_$app.sock && break - sleep 1 -done +wait_gunicorn_start #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index abe10cc..7a38992 100755 --- a/scripts/restore +++ b/scripts/restore @@ -64,12 +64,7 @@ yunohost service add $app --description="$app daemon for IHateMoney" --log=syste ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --line_match="Listening at" - -# line_match isn't enough because ihatemoney may stop if database upgrades -for _ in {1..20}; do - test -S /tmp/budget.gunicorn_$app.sock && break - sleep 1 -done +wait_gunicorn_start #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index abc26b4..0f14b13 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -162,12 +162,7 @@ yunohost service add $app --description="$app daemon for IHateMoney" --log=syste ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --line_match="Listening at" - -# line_match isn't enough because ihatemoney may stop if database upgrades -for _ in {1..20}; do - test -S /tmp/budget.gunicorn_$app.sock && break - sleep 1 -done +wait_gunicorn_start #================================================= # END OF SCRIPT