1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/monitorix_ynh.git synced 2024-09-03 19:46:06 +02:00

Use new findport fonction

This commit is contained in:
Josué Tille 2017-03-07 16:07:35 +01:00
parent 086e0a991b
commit a9d33b2cb5

View file

@ -53,6 +53,22 @@ CHECK_FINALPATH () { # Vérifie que le dossier de destination n'est pas déjà u
fi fi
} }
# Find a free port and return it
#
# example: port=$(ynh_find_port 8080)
#
# usage: ynh_find_port begin_port
# | arg: begin_port - port to start to search
ynh_find_port () {
port=$1
test -n "$port" || ynh_die "The argument of ynh_find_port must be a valid port."
while netcat -z 127.0.0.1 $port # Check if the port is free
do
port=$((port+1)) # Else, pass to next port
done
echo $port
}
### REMOVE SCRIPT ### REMOVE SCRIPT
REMOVE_NGINX_CONF () { # Suppression de la configuration nginx REMOVE_NGINX_CONF () { # Suppression de la configuration nginx