-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoordinator
More file actions
executable file
·43 lines (40 loc) · 1.07 KB
/
coordinator
File metadata and controls
executable file
·43 lines (40 loc) · 1.07 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
#!/usr/bin/env bash
usage() {
printf "%s usage:\n" "$(basename "$0")"
printf "\t-i SSH Key Path. If not specified, you will need to enter a password\n"
printf "\t-u SSH user\n"
printf "\t-H Trino Coordinator Hostname or IP\n"
printf "\t-f Local path to save the coordinator certificate\n"
printf "Make sure to check trino-setup for additional arguments\n"
}
# This is where the coordinator certificate will be saved locally
LOCAL_CERT="$(pwd)/trino-coordinator.crt"
SSH_USER="acceldata"
while getopts "u:i:f:H:h" arg; do
case $arg in
i) SSH_KEY=${OPTARG} ;;
u) SSH_USER=${OPTARG} ;;
H) HOST=${OPTARG} ;;
f) LOCAL_CERT=${OPTARG} ;;
h)
usage
exit 0
;;
*)
usage
exit 1
;;
esac
done
shift $((OPTIND - 1))
if [ -z "$HOST" ] || [ -z "$SSH_USER" ]; then
usage
exit 1
fi
if [ -n "$SSH_KEY" ]; then
ssh -i "$SSH_KEY" "$SSH_USER@$HOST" bash -s -- "$@" <trino-setup
scp -i "$SSH_KEY" "$SSH_USER@$HOST:/tmp/trino.crt" "$LOCAL_CERT"
else
ssh "$SSH_USER@$HOST" bash -s -- "$@" <trino-setup
scp "$SSH_USER@$HOST:/tmp/trino.crt" "$LOCAL_CERT"
fi