CAMEL-11130: Improve kill-karaf.sh so it doesn't fail even if there is no Karaf process on CI server
diff --git a/tests/camel-itest-karaf/kill-karaf.sh b/tests/camel-itest-karaf/kill-karaf.sh
index c1b709b..7933ff9 100755
--- a/tests/camel-itest-karaf/kill-karaf.sh
+++ b/tests/camel-itest-karaf/kill-karaf.sh
@@ -17,8 +17,13 @@
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
 
+XARGS_OPTIONS="-t -n1"
+if [ `uname` = "Linux" ]; then
+  XARGS_OPTIONS="$XARGS_OPTIONS --no-run-if-empty"
+fi
+
 echo "Listing all karaf processes"
 jps -l | grep karaf
 
 echo "Killing all karaf processes"
-jps -l | grep karaf | cut -d ' ' -f 1 | xargs -n1 kill
\ No newline at end of file
+jps -l | grep karaf | cut -d ' ' -f 1 | xargs $XARGS_OPTIONS kill
diff --git a/tests/camel-itest-osgi/kill-karaf.sh b/tests/camel-itest-osgi/kill-karaf.sh
index c1b709b..7933ff9 100755
--- a/tests/camel-itest-osgi/kill-karaf.sh
+++ b/tests/camel-itest-osgi/kill-karaf.sh
@@ -17,8 +17,13 @@
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
 
+XARGS_OPTIONS="-t -n1"
+if [ `uname` = "Linux" ]; then
+  XARGS_OPTIONS="$XARGS_OPTIONS --no-run-if-empty"
+fi
+
 echo "Listing all karaf processes"
 jps -l | grep karaf
 
 echo "Killing all karaf processes"
-jps -l | grep karaf | cut -d ' ' -f 1 | xargs -n1 kill
\ No newline at end of file
+jps -l | grep karaf | cut -d ' ' -f 1 | xargs $XARGS_OPTIONS kill