How exactly does EcalSys handles the processes. #2180
-
|
We are trying to use Ecalsys to run binaries and Shell scripts together, while doing this we faced some hiccups. It would be really helpful if you can provide answers to some of the questions we had.
In my bashscript, I've a trap for SIGKILL, and SIGINT which gracefully exits the bashscript. This works fine when ran in the terminal, but when used from ecalsys, its not getting trapped. my bash script somewhat looks like this, # !/bin/bash
python file1.py &
pid_f1=$!
python file2.py &
pid_f2=$!
cleanup() {
kill -9 $pid_f1;
kill -9 $pid_f2;
}
trap cleanup EXIT SIGINT SIGTERM
wait $pid_f2This trap works well for the shell script executed from terminal, but not with ecalsys. Please let me know if there is anything that we are missing here. Thank you cc: @git-pi-e |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
I also want to ask further whether there is any other way of cleanup available, using eCAL Sys itself. TIA |
Beta Was this translation helpful? Give feedback.
-
eCAL Sys unfortunately cannot handle shell scripts by itself. It cannot decide which interpreter to start. What you can do however is create a shell script as file and pass it to an interpreter of your choice as argument: bash /path/to/scriptnameIn eCAL Sys, this would translate to:
Note, that eCAL Sys will then only monitor the
eCAL Sys will at first send an eCAL Stop signal to the processes (if they are eCAL Processes). This will cause
I do not fully understand what you mean by cleanup and when this cleanup is supposed to happen.
|
Beta Was this translation helpful? Give feedback.
-
|
@FlorianReimold thanks for the reply.
I think this was the missing point in our case. If you see the generic shell script that i had shared, the script spawns two python processes in the background, and a cleanup function was written to kill the python processes when script receives EXIT signals. When i used the script as an executable in ecalsys, this cleanup was not getting triggered. However, i changed the executable and arguments like you mentioned and the cleanup function is working. Again, |
Beta Was this translation helpful? Give feedback.
eCAL Sys unfortunately cannot handle shell scripts by itself. It cannot decide which interpreter to start. What you can do however is create a shell script as file and pass it to an interpreter of your choice as argument:
In eCAL Sys, this would translate to:
bash/path/to/scriptnameNote, that eCAL Sys will then only monitor the
bashprocess and will be unaware of any other application that may be started from that script.eCAL Sys will at first send an eCAL St…