forked from UO-CIS-322/proj3-anagrams
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.sh
executable file
·46 lines (40 loc) · 1.02 KB
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! /bin/bash
#
# Usage: ./start.sh [port]
#
# Start the service as a background process, saving
# the process number (of the lead process) in SERVICE_PID.
#
#
PORTNUM=$1
if [[ "${PORTNUM}" == "" ]]; then
PORTNUM="8000"
fi;
echo "***Will listen on port ${PORTNUM}***"
this=${BASH_SOURCE[0]}
here=`dirname ${this}`
activate="${here}/env/bin/activate"
echo "Activating ${activate}"
source ${activate}
echo "Activated"
pushd vocab
python3 flask_vocab.py -P ${PORTNUM} &
pid=$!
popd
echo "${pid}" >SERVICE_PID
echo "***"
echo "Flask server started"
echo "PID ${pid} listening on port ${PORTNUM}"
echo "SERVICE_PID: " `cat SERVICE_PID`
echo "***"
#
#
# Design notes:
# This is a shell script outside the Makefile so that we
# can make sure it is run by bash, with one shell process
# running the whole script. Make uses a separate shell
# process for each line of a recipe, making it difficult to
# capture the process ID. Also Make can use a different
# shell, and may act differently between Windows and Unix.
#
# see also: stop.sh