diff --git a/script/server b/script/server index 42238e052d7f8ff92477f54b41a4ca50f8bcdd91..c60add75cc7b1166ed3033b25ab47c08416bb3c5 100755 --- a/script/server +++ b/script/server @@ -7,19 +7,20 @@ PORT=3000 while getopts ":p:" OPTION do - if OPTION='p' + if [ $OPTION == 'p' ] then PORT=$OPTARG fi done -services=$( netstat -nl | grep '[^:]:'$PORT'[ \t]') +services=$( netstat -nl | grep ":$PORT[ \t]") + test -n "$services" && { echo "Warning: something is already using port "$PORT echo " $services" exit } - +exit # Check if Mongo is running