-
Notifications
You must be signed in to change notification settings - Fork 6
/
log_nodeInfo.sh
executable file
·37 lines (25 loc) · 1.08 KB
/
log_nodeInfo.sh
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
#!/bin/bash
arch="$(dpkg --print-architecture)"
rm $PWD/simbel/nodeInfo.ds
if [[ "$arch" == 'armhf' ]]; then
output="$(./geth --datadir=$PWD/simbel/data console <<< $'admin.nodeInfo')"
if [[ "$output" =~ \"enode[^,]* ]]; then
echo "your enode is: ${BASH_REMATCH[0]}"
echo "${BASH_REMATCH[0]}" >> $PWD/simbel/nodeInfo.ds
fi
output="$(ifconfig)"
result=$(echo "$output" | (grep -oE "\b((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b" | head -1))
echo your ip address is: ${result}
echo "${result}" >> $PWD/simbel/nodeInfo.ds
# if not Linux-arm architecture
else
output="$(geth --datadir=$PWD/simbel/data console <<< $'admin.nodeInfo')"
if [[ "$output" =~ \"enode[^,]* ]]; then
echo "your enode is: ${BASH_REMATCH[0]}"
echo "${BASH_REMATCH[0]}" >> $PWD/simbel/nodeInfo.ds
fi
output="$(ifconfig)"
result=$(echo "$output" | (grep -oE "\b((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b" | head -1))
echo your ip address is: ${result}
echo "${result}" >> $PWD/simbel/nodeInfo.ds
fi