Use the kill command instead of killall 67/180267/1
authorDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 28 May 2018 03:43:31 +0000 (12:43 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 28 May 2018 03:43:31 +0000 (12:43 +0900)
Change-Id: Ie204325a1bb69a16f007a503a13deebfd90800d8
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
scripts/ivi/bt-stack-down.sh
scripts/mobile/bt-stack-down.sh
scripts/wearable/bt-stack-down.sh

index f21de24..e7445e8 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,10 +10,36 @@ 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-hf-agent
-killall bluetoothd
+
+OBEXD_PID=$($PGREP obexd)
+if [ "$OBEXD_PID" != "" ]; then
+       kill $OBEXD_PID
+fi
+
+OBEXDCLIENT_PID=$($PGREP obexd-client)
+if [ "$OBEXDCLIENT_PID" != "" ]; then
+       kill $OBEXDCLIENT_PID
+fi
+
+BTPB_AGENT_PID=$($PGREP bluetooth-pb-agent)
+if [ "$BTPB_AGENT_PID" != "" ]; then
+       kill $BTPB_AGENT_PID
+fi
+
+BTMAP_AGENT_PID=$($PGREP bluetooth-map-agent)
+if [ "$BTMAP_AGENT_PID" != "" ]; then
+       kill $BTMAP_AGENT_PID
+fi
+
+BTHF_AGENT_PID=$($PGREP bluetooth-hf-agent)
+if [ "$BTHF_AGENT_PID" != "" ]; then
+       kill $BTHF_AGENT_PID
+fi
+
+BLUETOOTHD_PID=$($PGREP bluetoothd)
+if [ "$BLUETOOTHD_PID" != "" ]; then
+       kill $BLUETOOTHD_PID
+fi
 
 # result
 exit 0
index 0f8926f..4a673d4 100644 (file)
@@ -1,5 +1,6 @@
 #!/bin/sh
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
+PGREP=/usr/bin/pgrep
 
 #
 # Script for stopping Bluetooth stack
@@ -12,14 +13,51 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin
 /usr/bin/touch /run/.hci_logger_stop
 
 # Kill BlueZ bluetooth stack
-killall obexd obex-client
-killall bt-syspopup
-killall bluetooth-pb-agent
-killall bluetooth-map-agent
-killall bluetooth-hfp-agent
-killall bluetooth-ag-agent
-killall bluetoothd
-killall bluetooth-share
+
+OBEXD_PID=$($PGREP obexd)
+if [ "$OBEXD_PID" != "" ]; then
+       kill $OBEXD_PID
+fi
+
+OBEXDCLIENT_PID=$($PGREP obexd-client)
+if [ "$OBEXDCLIENT_PID" != "" ]; then
+       kill $OBEXDCLIENT_PID
+fi
+
+BTSYSPOPUP_PID=$($PGREP bt-syspopup)
+if [ "BTSYSPOPUP_PID" != "" ]; then
+       kill BTSYSPOPUP_PID
+fi
+
+BTSHARE_PID=$($PGREP bluetooth-share)
+if [ "$BTSHARE_PID" != "" ]; then
+       kill $BTSHARE_PID
+fi
+
+BTPB_AGENT_PID=$($PGREP bluetooth-pb-agent)
+if [ "$BTPB_AGENT_PID" != "" ]; then
+       kill $BTPB_AGENT_PID
+fi
+
+BTMAP_AGENT_PID=$($PGREP bluetooth-map-agent)
+if [ "$BTMAP_AGENT_PID" != "" ]; then
+       kill $BTMAP_AGENT_PID
+fi
+
+BTHFP_AGENT_PID=$($PGREP bluetooth-hfp-agent)
+if [ "$BTHFP_AGENT_PID" != "" ]; then
+       kill $BTHFP_AGENT_PID
+fi
+
+BTAG_AGENT_PID=$($PGREP bluetooth-ag-agent)
+if [ "$BTAG_AGENT_PID" != "" ]; then
+       kill $BTAG_AGENT_PID
+fi
+
+BLUETOOTHD_PID=$($PGREP bluetoothd)
+if [ "$BLUETOOTHD_PID" != "" ]; then
+       kill $BLUETOOTHD_PID
+fi
 
 # result
 exit 0
index ae3e496..22f3043 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/sh
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
+PGREP=/usr/bin/pgrep
 
 #
 # Script for stopping Bluetooth stack
@@ -12,13 +13,47 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin
 /usr/bin/touch /run/.hci_logger_stop
 
 # Kill BlueZ bluetooth stack
-killall obexd obex-client
-killall bluetooth-pb-agent
-killall bluetooth-map-agent
-killall bluetooth-hfp-agent
-killall bluetooth-hf-agent
-killall bluetooth-ag-agent
-killall bluetoothd
+
+OBEXD_PID=$($PGREP obexd)
+if [ "$OBEXD_PID" != "" ]; then
+       kill $OBEXD_PID
+fi
+
+OBEXDCLIENT_PID=$($PGREP obexd-client)
+if [ "$OBEXDCLIENT_PID" != "" ]; then
+       kill $OBEXDCLIENT_PID
+fi
+
+BTPB_AGENT_PID=$($PGREP bluetooth-pb-agent)
+if [ "$BTPB_AGENT_PID" != "" ]; then
+       kill $BTPB_AGENT_PID
+fi
+
+BTMAP_AGENT_PID=$($PGREP bluetooth-map-agent)
+if [ "$BTMAP_AGENT_PID" != "" ]; then
+       kill $BTMAP_AGENT_PID
+fi
+
+BTHFP_AGENT_PID=$($PGREP bluetooth-hfp-agent)
+if [ "$BTHFP_AGENT_PID" != "" ]; then
+       kill $BTHFP_AGENT_PID
+fi
+
+BTHF_AGENT_PID=$($PGREP bluetooth-hf-agent)
+if [ "$BTHF_AGENT_PID" != "" ]; then
+       kill $BTHF_AGENT_PID
+fi
+
+BTAG_AGENT_PID=$($PGREP bluetooth-ag-agent)
+if [ "$BTAG_AGENT_PID" != "" ]; then
+       kill $BTAG_AGENT_PID
+fi
+
+BLUETOOTHD_PID=$($PGREP bluetoothd)
+if [ "$BLUETOOTHD_PID" != "" ]; then
+       kill $BLUETOOTHD_PID
+fi
+
 
 # result
 exit 0