From a9070ce6e66133b7a1e92c8b6a3b114070cfec11 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Mon, 10 Sep 2018 16:35:25 +0200 Subject: [PATCH] sitl_run.sh: fix process grep for jMAVSim It seems that the oneline to find the process ID of any running jMAVSim instance was not working correctly. 1. On Linux, the name of the process does not contain Simulator but jmavsim_run.jar. Also, it triggers incorrectly, if you have opened Simulator.java using the command line :). 2. The cutting to get the PID at the end does not work as intenteded and gives the username instead of PID, at least on Arch Linux. Using awk should fix this. --- Tools/sitl_run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/sitl_run.sh b/Tools/sitl_run.sh index 050d3e2998..560838701c 100755 --- a/Tools/sitl_run.sh +++ b/Tools/sitl_run.sh @@ -47,7 +47,7 @@ pkill -x gazebo || true pkill -x px4 || true pkill -x px4_$model || true -jmavsim_pid=`ps aux | grep java | grep Simulator | cut -d" " -f1` +jmavsim_pid=`ps aux | grep java | grep "\-jar jmavsim_run.jar" | awk '{ print $2 }'` if [ -n "$jmavsim_pid" ] then kill $jmavsim_pid