Skip to content

Commit

Permalink
improve scripts to run and kill services
Browse files Browse the repository at this point in the history
  • Loading branch information
rspurgeon committed Jul 6, 2023
1 parent d8dbc79 commit cc2662e
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 28 deletions.
36 changes: 24 additions & 12 deletions kill-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,42 @@

source PORTS.env

echo "Killing routes service"
if [[ -f "./flight-data/routes/routes.pid" ]];
then
kill -15 $(cat ./flight-data/routes/routes.pid)
rm -f ./flight-data/routes/routes.pid
pid=$(cat ./flight-data/routes/routes.pid)
echo "Killing routes service $pid"
kill $pid
rm -f ./flight-data/routes/routes.pid
else
echo "No routes service pid found"
fi

echo "Killing flgiths service"
if [[ -f "./flight-data/flights/flights.pid" ]];
then
kill -15 $(cat ./flight-data/flights/flights.pid)
rm -f ./flight-data/flights/flights.pid
pid=$(cat ./flight-data/flights/flights.pid)
echo "Killing flights service $pid"
kill $pid
rm -f ./flight-data/flights/flights.pid
else
echo "No flights service pid found"
fi

echo "Killing customer service"
if [[ -f "./sales/customer/customer.pid" ]];
then
kill -15 $(cat ./sales/customer/customer.pid)
rm -f ./sales/customer/customer.pid
pid=$(cat ./sales/customer/customer.pid)
echo "Killing customer service $pid"
kill $pid
rm -f ./sales/customer/customer.pid
else
echo "No customer service pid found"
fi

echo "Killing bookings service"
if [[ -f "./sales/bookings/bookings.pid" ]];
then
kill -15 $(cat ./sales/bookings/bookings.pid)
rm -f ./sales/bookings/bookings.pid
pid=$(cat ./sales/bookings/bookings.pid)
echo "Killing bookings service $pid"
kill $pid
rm -f ./sales/bookings/bookings.pid
else
echo "No bookings service pid found"
fi
46 changes: 30 additions & 16 deletions run-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,41 @@
source PORTS.env

./kill-all.sh
echo "------------------------------------"

pushd ./flight-data/routes
echo "Running routes service"
(cd ./flight-data/routes && make build)
./flight-data/routes/routes "$KONG_AIR_ROUTES_PORT" > /tmp/routes.log 2>&1 &
echo $! > ./flight-data/routes/routes.pid
echo "Routes process:" $(cat ./flight-data/routes/routes.pid)
make build
./routes "$KONG_AIR_ROUTES_PORT" > /tmp/routes.log 2>&1 &
echo $! > ./routes.pid
echo "Routes process ID:" $(cat ./routes.pid)
echo "------------------------------------"
popd

pushd ./flight-data/flights
echo "Running flights service"
(cd ./flight-data/flights && make build)
./flight-data/flights/flights "$KONG_AIR_FLIGHTS_PORT" > /tmp/flights.log 2>&1 &
echo $! > ./flight-data/flights/flights.pid
echo "Flights process:" $(cat ./flight-data/flights/flights.pid)
make build
./flights "$KONG_AIR_FLIGHTS_PORT" > /tmp/flights.log 2>&1 &
echo $! > ./flights.pid
echo "Flights process ID:" $(cat ./flights.pid)
echo "------------------------------------"
popd

pushd ./sales/customer
echo "Running customer service"
(cd ./sales/customer && make build)
node ./sales/customer/main.js "$KONG_AIR_CUSTOMER_PORT" > /tmp/customer.log 2>&1 &
echo $! > ./sales/customer/customer.pid
echo "Customer process:" $(cat ./sales/customer/customer.pid)
make build
node ./main.js "$KONG_AIR_CUSTOMER_PORT" > /tmp/customer.log 2>&1 &
echo $! > ./customer.pid
echo "Customer process ID:" $(cat ./customer.pid)
echo "------------------------------------"
popd

pushd ./sales/bookings
echo "Running bookings service"
(cd ./sales/bookings && make build)
node ./sales/bookings/main.js "$KONG_AIR_BOOKINGS_PORT" > /tmp/bookings.log 2>&1 &
echo $! > ./sales/bookings/bookings.pid
echo "Bookings process:" $(cat ./sales/bookings/bookings.pid)
make build
node ./main.js "$KONG_AIR_BOOKINGS_PORT" > /tmp/bookings.log 2>&1 &
echo $! > ./bookings.pid
echo "Bookings process ID:" $(cat ./bookings.pid)
echo "------------------------------------"
popd

0 comments on commit cc2662e

Please sign in to comment.