19 lines
520 B
Bash
19 lines
520 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
RED='\033[0;31m'
|
||
|
GREEN='\033[0;32m'
|
||
|
YELLOW='\033[1;33m'
|
||
|
NC='\033[0m'
|
||
|
|
||
|
METRO_PORT=8081
|
||
|
METRO_PID="$(lsof -i :${METRO_PORT} | awk 'NR!=1 {print $2}')"
|
||
|
if [ ! -z $METRO_PID ]; then
|
||
|
echo -e "${YELLOW}TCP port ${METRO_PORT} is required by the Metro packager.\nThe following process currently has the port open, preventing Metro from starting:${NC}"
|
||
|
ps -fp $METRO_PID
|
||
|
echo -e "${YELLOW}Do you want to terminate it (y/n)?${NC}"
|
||
|
read -n 1 term
|
||
|
[[ $term == 'y' ]] && kill $METRO_PID
|
||
|
fi
|
||
|
|
||
|
react-native start
|