2019-03-01 13:24:23 +00:00
#!/usr/bin/env bash
2018-11-23 08:56:31 +00:00
2020-03-02 11:18:01 +00:00
GIT_ROOT = $( cd " ${ BASH_SOURCE %/* } " && git rev-parse --show-toplevel)
source " ${ GIT_ROOT } /scripts/colors.sh "
2018-11-23 08:56:31 +00:00
METRO_PORT = 8081
2019-01-08 15:05:24 +00:00
METRO_PID = " $( lsof -i :${ METRO_PORT } | awk 'NR!=1 {print $2}' | sort -u | tr '\r\n' ' ' ) "
if [ ! -z " $METRO_PID " ] ; then
2020-03-02 11:18:01 +00:00
echo -e " ${ YLW } TCP port ${ METRO_PORT } is required by the Metro packager.\nThe following processes currently have the port open, preventing Metro from starting: ${ RST } "
2018-11-23 08:56:31 +00:00
ps -fp $METRO_PID
2020-03-02 11:18:01 +00:00
echo -e " ${ YLW } Do you want to terminate them (y/n)? ${ RST } "
2018-11-23 08:56:31 +00:00
read -n 1 term
[ [ $term = = 'y' ] ] && kill $METRO_PID
fi
2019-09-13 08:46:36 +00:00
yarn start