Replace the killall to pgrep 59/147559/1
authorHyuk Lee <hyuk0512.lee@samsung.com>
Tue, 5 Sep 2017 01:59:48 +0000 (10:59 +0900)
committerHyuk Lee <hyuk0512.lee@samsung.com>
Tue, 5 Sep 2017 01:59:48 +0000 (10:59 +0900)
Change-Id: Ia37473989d281938a0ec4387b4e9ba8243821888
Signed-off-by: Hyuk Lee <hyuk0512.lee@samsung.com>
scripts/etc/bt-stack-down.sh

index 806f50f..d37eabe 100644 (file)
@@ -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