-
Notifications
You must be signed in to change notification settings - Fork 174
Expand file tree
/
Copy pathrun_sdr.sh
More file actions
30 lines (28 loc) · 1016 Bytes
/
Copy pathrun_sdr.sh
File metadata and controls
30 lines (28 loc) · 1016 Bytes
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
#!/bin/bash
#
# start and stop the GNSS receiver server with Web UI
#
# MSYS2 relays SIGQUIT to a native Windows process as CTRL_BREAK_EVENT, the only
# signal a background pocket_web.exe can catch. Plain kill is TerminateProcess
# and leaves the RF frontend streaming, which needs a USB reset to recover.
#
# ps prints the arguments as well on macOS, so the pattern has to be kept out of
# the command line of the processes doing the matching.
#
case $(uname -s) in
MSYS*|MINGW*|CYGWIN*) SIG=-QUIT;;
*) SIG=-TERM;;
esac
if [ "$1" = -stop ]; then
ps -e | grep -v grep | grep pocket_web | awk '{print $1}' | xargs -r kill $SIG
for i in $(seq 20); do # wait for the device close before returning
ps -e | grep -v grep | grep -q pocket_web || break
sleep 0.5
done
elif ps -e | grep -v grep | grep -q pocket_web; then
echo 'pocket_web already running.'
elif [ "$1" = -start ]; then
./bin/pocket_web -start -web 0.0.0.0:8080 &
else
./bin/pocket_web -web 0.0.0.0:8080 &
fi