forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ssh.sh
executable file
·78 lines (66 loc) · 1.32 KB
/
ssh.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env bash
here=$(dirname "$0")
# shellcheck source=net/common.sh
source "$here"/common.sh
usage() {
exitcode=0
if [[ -n "$1" ]]; then
exitcode=1
echo "Error: $*"
fi
cat <<EOF
usage: $0 [ipAddress] [extra ssh arguments]
ssh into a node
ipAddress - IP address of the desired node.
If ipAddress is unspecified, a list of available nodes will be displayed.
EOF
exit $exitcode
}
while getopts "h?" opt; do
case $opt in
h | \?)
usage
;;
*)
usage "Error: unhandled option: $opt"
;;
esac
done
loadConfigFile
ipAddress=$1
shift
if [[ -n "$ipAddress" ]]; then
set -x
exec ssh "${sshOptions[@]}" "$ipAddress" "$@"
fi
printNode() {
declare nodeType=$1
declare ip=$2
printf " %-25s | For logs run: $0 $ip tail -f solana/$nodeType.log\n" "$0 $ip"
}
echo Validators:
for ipAddress in "${validatorIpList[@]}"; do
printNode validator "$ipAddress"
done
echo
echo Clients:
if [[ ${#clientIpList[@]} -eq 0 ]]; then
echo " None"
else
for ipAddress in "${clientIpList[@]}"; do
printNode client "$ipAddress"
done
fi
echo
echo Blockstreamers:
if [[ ${#blockstreamerIpList[@]} -eq 0 ]]; then
echo " None"
else
for ipAddress in "${blockstreamerIpList[@]}"; do
printNode validator "$ipAddress"
done
fi
echo
echo "Use |scp.sh| to transfer files to and from nodes"
echo
exit 0