Closed klemie closed 4 weeks ago
@jjderooy made this. but it has seemed to cause a bug or is part of a bug. Now we cant send serial and have instrumentation running at the same time. Might need to investigate this more.
Ok I fogor to commit and push the bash file I made on the mini pc but I know what the problem is. Basically, &
on the end of a bash command (like the ones starting the python scripts) starts that in a new process in the background. When doing ctrl-c in the terminal shown by running the bash script, it only terminates the foreground process and not the background processes.
We can fix this by trap
ing the ctrl+c input to run a command before exiting the bash script like this:
trap ctrl_c INT
function ctrl_c() {
echo "Trapped CTRL_C"
kill -INT $PID1 $PID2 $PID3... # Send interrupt signal to each process
}
# Rest of original script here:
python read_labjack.py &
python ws.py &
...
I'll try and test this tmr and push it if it works.
I tested this among other variations and cannot for the life of me get it to work. Pressing ctrl+c interrupts the bash process, and then when the signal is trapped, it errors on kill -INT
saying the PIDs aren't found. I'll have to do some more testing.
Done. I ended up not using bash and instead using python subprocesses.
Description
Create a bash script that runs everything in one command. Take it one step further and get it to run on startup. Would love to dockerize it but serial and labjack is a no go because there external devices
Acceptance Criteria
serail-main.py
,read-labjack.py
,instrumentation-web-socket.py
and starts ground support seestart_gui.sh
QA Notes
Linked issues
Blocked by the PR