Replace the killall to pgrep
[platform/core/connectivity/bluetooth-tools.git] / scripts / etc / bt-stack-down.sh
1 #!/bin/sh
2 PATH=/bin:/usr/bin:/sbin:/usr/sbin
3 PGREP=/usr/bin/pgrep
4
5 #
6 # Script for stopping Bluetooth stack
7 #
8
9 # Remove BT device
10 /usr/etc/bluetooth/bt-dev-end.sh
11
12 # Kill BlueZ bluetooth stack
13
14 if ($PGREP bluetooth); then
15         BLUETOOTH_PID=$($PGREP bluetooth)
16         kill $BLUETOOTH_PID
17 fi
18
19 if ($PGREP obexd); then
20         OBEXD_PID=$($PGREP obexd)
21         kill $OBEXD_PID
22 fi
23
24 if ($PGREP obexd-client); then
25         OBEXDCLIENT_PID=$($PGREP obexd-client)
26         kill $OBEXDCLIENT_PID
27 fi
28
29 if ($PGREP bluetooth-share); then
30         BTSHARE_PID=$($PGREP bluetooth-share)
31         kill $BTSHARE_PID
32 fi
33
34 if ($PGREP bluetooth-pb-agent); then
35         BTPB_AGENT_PID=$($PGREP bluetooth-pb-agent)
36         kill $BTPB_AGENT_PID
37 fi
38
39 if ($PGREP bluetooth-map-agent); then
40         BTMAP_AGENT_PID=$($PGREP bluetooth-map-agent)
41         kill $BTMAP_AGENT_PID
42 fi
43
44 if ($PGREP bluetooth-hfp-agent); then
45         BTHFP_AGENT_PID=$($PGREP bluetooth-hfp-agent)
46         kill $BTHFP_AGENT_PID
47 fi
48
49 if ($PGREP bluetoothd); then
50         BLUETOOTHD_PID=$($PGREP bluetoothd)
51         kill $BLUETOOTHD_PID
52 fi
53
54
55 # result
56 exit 0