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:
parent
4e0e9a3522
commit
d2633bf32b
5 changed files with 41 additions and 4 deletions
|
@ -22,6 +22,19 @@ COMMIT="bc855b0a1722d2f4ac534ea4d4035299acb7a40a"
|
||||||
# PERSONAL HELPERS
|
# 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
|
# EXPERIMENTAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -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_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
sleep 10
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
@ -128,6 +127,13 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
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
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -218,7 +218,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
sleep 10
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
|
@ -240,6 +239,13 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=2
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
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
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -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_script_progression --message="Starting a systemd service..." --weight=2
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
sleep 10
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
# 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
|
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
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -245,7 +245,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2
|
||||||
|
|
||||||
# Start a systemd service
|
# Start a systemd service
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||||
sleep 10
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE FAIL2BAN
|
# UPGRADE FAIL2BAN
|
||||||
|
@ -262,6 +261,13 @@ ynh_script_progression --message="Reloading nginx web server..." --weight=1
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
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
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue