Modify the bt-stack-up.sh in common profile
[platform/core/connectivity/bluetooth-tools.git] / scripts / etc / bt-stack-down.sh
index 8d20e47..a7b6071 100644 (file)
@@ -1,4 +1,6 @@
 #!/bin/sh
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+PGREP=/usr/bin/pgrep
 
 #
 # Script for stopping Bluetooth stack
 /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
+
+BLUETOOTH_PID=$($PGREP bluetooth)
+if [ "$BLUETOOTH_PID" != "" ]; then
+       kill $BLUETOOTH_PID
+fi
+
+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
+
+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
+
+BLUETOOTHD_PID=$($PGREP bluetoothd)
+if [ "$BLUETOOTHD_PID" != "" ]; then
+       kill $BLUETOOTHD_PID
+fi
+
 
 # result
 exit 0