File tree Expand file tree Collapse file tree 1 file changed +10
-14
lines changed
Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -16,26 +16,22 @@ PORT=$1
1616source $HESTIA /func/main.sh
1717source $HESTIA /conf/hestia.conf
1818
19- # Define not usable ports
20- BUSY_PORTS=(' 80' ' 443' ' 8080' ' 8443' )
21-
19+ # Functions
2220is_port_valid () {
23-
2421 # Check if PORT is numeric
2522 if [[ ! $PORT =~ ^[0-9]+$ ]]; then
26- echo ' Port should contains a numeric value only!'
27- log_event $E_NOTEXIST " $ARGUMENTS "
28- exit $E_NOTEXIST
23+ echo " Port should contains a numeric value only!"
24+ log_event $E_INVALID " $ARGUMENTS "
25+ exit $E_INVALID
2926 fi
3027
3128 # Check if PORT is already used
32- for BUSY_PORT in ${BUSY_PORTS[@]} ; do
33- if [ " $BUSY_PORT " = " $PORT " ]; then
34- echo ' Port is already used by Hestia, please set anotherone!'
35- log_event $E_NOTEXIST " $ARGUMENTS "
36- exit $E_NOTEXIST
37- fi
38- done
29+ BUSY_PORT=$( lsof -i:$PORT )
30+ if [ ! -z " $BUSY_PORT " ]; then
31+ echo " Port is already used by Hestia, please set anotherone!"
32+ log_event $E_INUSE " $ARGUMENTS "
33+ exit $E_INUSE
34+ fi
3935}
4036
4137
You can’t perform that action at this time.
0 commit comments