-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsave.sh
More file actions
executable file
·60 lines (51 loc) · 1.74 KB
/
Copy pathsave.sh
File metadata and controls
executable file
·60 lines (51 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
# Define a function to get the IP address for a given box name
get_ip_for_box() {
case "$1" in
"GI1") echo "192.168.12.43" ;;
"GI2") echo "192.168.12.44" ;;
"GI3") echo "192.168.12.42" ;;
"GI4") echo "192.168.12.32" ;;
"GI5") echo "192.168.12.40" ;;
"GO1") echo "192.168.12.35" ;;
"GO2") echo "192.168.12.39" ;;
"BV1") echo "192.168.12.41" ;;
"BV2") echo "192.168.12.23" ;;
"DP1") echo "192.168.12.28" ;;
"DP2") echo "192.168.12.45" ;;
*) echo "" ;;
esac
}
# Define the package name of the service
service_package="com.bsmart.scanner.service.SmartPortService"
# Define an array of box names
boxes=("GI1" "GI2" "GI3" "GI4" "GI5" "GO1" "GO2" "BV1" "BV2" "DP1" "DP2")
# Prompt user to select a box
PS3="Select a box: "
select box_name in "${boxes[@]}"
do
if [[ -n $box_name ]]; then
ip=$(get_ip_for_box "$box_name")
# Connect to the device using adb
adb -s $ip connect $ip > /dev/null 2>&1
# Check if the connection was successful
if [ $? -eq 0 ]; then
# Connection successful, check the status of the service
status=$(adb -s $ip shell dumpsys activity services | grep $service_package)
# Check if the service is running
if [ -n "$status" ]; then
echo "Box $box_name ($ip): SmartPortService is running"
else
echo "Box $box_name ($ip): SmartPortService is not running"
fi
else
# Connection failed
echo "Box $box_name ($ip): Offline"
fi
# Disconnect from the device
adb disconnect $ip > /dev/null 2>&1
break
else
echo "Invalid selection. Please try again."
fi
done