From 5b364b7c6e5b6ea76ae7d3a9ff6c374626ca9ea8 Mon Sep 17 00:00:00 2001 From: Hyuk Lee Date: Tue, 5 Sep 2017 10:59:48 +0900 Subject: [PATCH] Replace the killall to pgrep Change-Id: Ia37473989d281938a0ec4387b4e9ba8243821888 Signed-off-by: Hyuk Lee --- scripts/etc/bt-stack-down.sh | 49 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/scripts/etc/bt-stack-down.sh b/scripts/etc/bt-stack-down.sh index 806f50f..d37eabe 100644 --- a/scripts/etc/bt-stack-down.sh +++ b/scripts/etc/bt-stack-down.sh @@ -1,5 +1,6 @@ #!/bin/sh PATH=/bin:/usr/bin:/sbin:/usr/sbin +PGREP=/usr/bin/pgrep # # Script for stopping Bluetooth stack @@ -9,13 +10,47 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin /usr/etc/bluetooth/bt-dev-end.sh # Kill BlueZ bluetooth stack -killall bluetooth -killall obexd obex-client -killall bluetooth-share -killall bluetooth-pb-agent -killall bluetooth-map-agent -killall bluetooth-hfp-agent -killall bluetoothd + +if ($PGREP bluetooth); then + BLUETOOTH_PID=$($PGREP bluetooth) + kill $BLUETOOTH_PID +fi + +if ($PGREP obexd); then + OBEXD_PID=$($PGREP obexd) + kill $OBEXD_PID +fi + +if ($PGREP obexd-client); then + OBEXDCLIENT_PID=$($PGREP obexd-client) + kill $OBEXDCLIENT_PID +fi + +if ($PGREP bluetooth-share); then + BTSHARE_PID=$($PGREP bluetooth-share) + kill $BTSHARE_PID +fi + +if ($PGREP bluetooth-pb-agent); then + BTPB_AGENT_PID=$($PGREP bluetooth-pb-agent) + kill $BTPB_AGENT_PID +fi + +if ($PGREP bluetooth-map-agent); then + BTMAP_AGENT_PID=$($PGREP bluetooth-map-agent) + kill $BTMAP_AGENT_PID +fi + +if ($PGREP bluetooth-hfp-agent); then + BTHFP_AGENT_PID=$($PGREP bluetooth-hfp-agent) + kill $BTHFP_AGENT_PID +fi + +if ($PGREP bluetoothd); then + BLUETOOTHD_PID=$($PGREP bluetoothd) + kill $BLUETOOTHD_PID +fi + # result exit 0 -- 2.7.4