-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart
executable file
·60 lines (52 loc) · 1.21 KB
/
start
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env bash
# Usage: ./start [nongrok|nogrok]
quit() {
# echo "start EOF"
kill $ngrok_pid 2> /dev/null
kill $frpc_pid 2> /dev/null
exit 0
}
trap quit EXIT
usage() {
echo "Usage: $(basename $0) [-f <0|1>] [-n <0|1>]"
echo " -f ... Start frpc (Default 1)"
echo " -n ... Start ngrok (Default 0)"
exit 1
}
start_frpc=true
start_ngrok=false
while getopts ":f:n:h" opts; do
case "${opts}" in
f)
f=${OPTARG}
[[ $f -eq 0 || $f -eq 1 ]] || usage
[[ $f -eq 1 || -z $f ]] && start_frpc=true || start_frpc=false
;;
n)
n=${OPTARG}
[[ $n -eq 0 || $n -eq 1 ]] || usage
[[ $n -eq 1 || -z $n ]] && start_ngrok=true || start_ngrok=false
;;
h)
usage
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
if $start_frpc; then
# start frpc (in the background)
echo "Starting frpc.sh..."
./frpc.sh > /dev/null &
frpc_pid=$!
fi
if $start_ngrok; then
# start ngrok (in the background)
echo "Starting ngrok.sh..."
./ngrok.sh noui > /dev/null &
ngrok_pid=$!
fi
# run plotter-server
python main.py