First attempt at detecting called port with getopts
This commit is contained in:
parent
ccdc259838
commit
3f9a51fa3f
1 changed files with 12 additions and 3 deletions
|
|
@ -3,10 +3,19 @@
|
||||||
# Start diaspora websocket and main services
|
# Start diaspora websocket and main services
|
||||||
#
|
#
|
||||||
|
|
||||||
# Is someone listening on 3000 already? (ipv4 only test ?)
|
# Is someone listening on the port already? (ipv4 only test ?)
|
||||||
services=$( netstat -nl | grep '[^:]:3000[ \t]')
|
PORT=3000
|
||||||
|
while getopts ":p:" OPTION
|
||||||
|
do
|
||||||
|
if OPTION='p'
|
||||||
|
then
|
||||||
|
PORT=$OPTARG
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
services=$( netstat -nl | grep '[^:]:'+ $PORT +'[ \t]')
|
||||||
test -n "$services" && {
|
test -n "$services" && {
|
||||||
echo "Warning: something is already using port 3000"
|
echo "Warning: something is already using port " + $PORT
|
||||||
echo " $services"
|
echo " $services"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue