1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/snweb_ynh.git synced 2024-09-03 20:26:22 +02:00

Add is_server_ready check

This commit is contained in:
Fabian Wilkens 2021-05-05 20:27:17 +02:00
parent 4e0e9a3522
commit d2633bf32b
No known key found for this signature in database
GPG key ID: 23DFA025BB4E9FAB
5 changed files with 41 additions and 4 deletions

View file

@ -22,6 +22,19 @@ COMMIT="bc855b0a1722d2f4ac534ea4d4035299acb7a40a"
# PERSONAL HELPERS
#=================================================
# Check if service is ready
is_service_ready() {
for ((i = 0 ; i < 15 ; i++))
do
if [ "200" -eq $(curl --silent --insecure --resolve $domain:443:127.0.0.1 https://$domain$path_url/ -o /dev/null --write-out "%{http_code}") ]
then
break
else
sleep 2
fi
done
}
#================================================
# EXPERIMENTAL HELPERS
#=================================================

View file

@ -119,7 +119,6 @@ ynh_replace_string --match_string="APP_HOST=http://localhost:3001" --replace_str
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
sleep 10
#=================================================
# RELOAD NGINX
@ -128,6 +127,13 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# WAITING FOR SERVICE
#=================================================
ynh_script_progression --message="Waiting for service..." --weight=1
is_service_ready
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -218,7 +218,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
sleep 10
#=================================================
# SETUP SSOWAT
@ -240,6 +239,13 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=2
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# WAITING FOR SERVICE
#=================================================
ynh_script_progression --message="Waiting for service..." --weight=1
is_service_ready
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -133,7 +133,6 @@ yunohost service add $app --description "Standard Notes" --log "/var/log/$app/$a
ynh_script_progression --message="Starting a systemd service..." --weight=2
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
sleep 10
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
@ -150,6 +149,13 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=2
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# WAITING FOR SERVICE
#=================================================
ynh_script_progression --message="Waiting for service..." --weight=1
is_service_ready
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -245,7 +245,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
sleep 10
#=================================================
# UPGRADE FAIL2BAN
@ -262,6 +261,13 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# WAITING FOR SERVICE
#=================================================
ynh_script_progression --message="Waiting for service..." --weight=1
is_service_ready
#=================================================
# END OF SCRIPT
#=================================================