mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
use ynh_port_available in ynh_find_port
This commit is contained in:
parent
b6daf0c448
commit
dd5699ee40
1 changed files with 2 additions and 2 deletions
|
@ -18,7 +18,7 @@ ynh_find_port () {
|
|||
ynh_handle_getopts_args "$@"
|
||||
|
||||
test -n "$port" || ynh_die --message="The argument of ynh_find_port must be a valid port."
|
||||
while ss --numeric --listening --tcp --udp | awk '{print$5}' | grep --quiet --extended-regexp ":$port$" # Check if the port is free
|
||||
while ! ynh_port_available --port=$port
|
||||
do
|
||||
port=$((port+1)) # Else, pass to next port
|
||||
done
|
||||
|
@ -42,7 +42,7 @@ ynh_port_available () {
|
|||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
|
||||
if ss --numeric --listening --tcp --udp | grep --quiet --word-regexp :$port
|
||||
if ss --numeric --listening --tcp --udp | awk '{print$5}' | grep --quiet --extended-regexp ":$port$" # Check if the port is free
|
||||
then
|
||||
return 1
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue