onos/tools/test/bin/onos-kill
Jordan Halterman a4c4ea8acd Update onos-kill script to kill correct Karaf process
Change-Id: I1192d06cb8da586b7e5d0b1709fc1917962a9c9b
2018-11-15 23:16:11 +00:00

19 lines
657 B
Bash
Executable File

#!/bin/bash
# -----------------------------------------------------------------------------
# Remotely kills the ONOS service on the specified node.
# -----------------------------------------------------------------------------
[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
. $ONOS_ROOT/tools/build/envDefaults
ssh $ONOS_USER@${1:-$OCI} "
pid=\$(ps -ef | grep org.apache.karaf.main.Main | grep -v grep | cut -c10-15 | tr -d ' ')
if [ -n \"\$pid\" ]; then
echo \"Killing ONOS process \$pid on \$(hostname)...\"
kill -9 \$pid
else
echo \"ONOS process is not running...\"
exit 1
fi
"