1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ihatemoney_ynh.git synced 2024-09-03 19:26:15 +02:00

Deduplicate code to wait for server to start

This commit is contained in:
Salamandar 2023-06-10 23:09:04 +02:00 committed by Félix Piédallu
parent 5605f62ae6
commit 66e47fb9c8
5 changed files with 12 additions and 19 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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