diff options
author | sharath <sharathkumarboyanapally@gmail.com> | 2018-08-21 11:01:26 +0530 |
---|---|---|
committer | Peter Mikus <pmikus@cisco.com> | 2018-09-27 08:18:41 +0000 |
commit | 19947738140e71d8d9fa90349e68f6261f5a612f (patch) | |
tree | 663ccab317082bf17dd5382fda754f56a57848c8 /tests/dmm/dmm_scripts/kill_given_proc.sh | |
parent | ebd0c7defaffdd6cd3ff2b5f580c86601917a0c7 (diff) |
integration of DMM+lwip testscripts
Change-Id: Ifb1a0702353e71c61a694dea5164df41f4e23389
Signed-off-by: sharath <sharathkumarboyanapally@gmail.com>
Diffstat (limited to 'tests/dmm/dmm_scripts/kill_given_proc.sh')
-rwxr-xr-x | tests/dmm/dmm_scripts/kill_given_proc.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/dmm/dmm_scripts/kill_given_proc.sh b/tests/dmm/dmm_scripts/kill_given_proc.sh new file mode 100755 index 0000000000..772643a316 --- /dev/null +++ b/tests/dmm/dmm_scripts/kill_given_proc.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +proc_name=$1 +sudo pgrep $proc_name +if [ $? -eq "0" ]; then + success=false + sudo pkill $proc_name + echo "RC = $?" + for attempt in {1..5}; do + echo "Checking if '$proc_name' is still alive, attempt nr ${attempt}" + sudo pgrep $proc_name + if [ $? -eq "1" ]; then + echo "'$proc_name' is dead" + success=true + break + fi + echo "'$proc_name' is still alive, waiting 1 second" + sleep 1 + done + if [ "$success" = false ]; then + echo "The command sudo pkill '$proc_name' failed" + sudo pkill -9 $proc_name + echo "RC = $?" + exit 1 + fi +else + echo "'$proc_name' is not running" +fi + +sleep 2 +exit 0
\ No newline at end of file |