This repository was archived by the owner on May 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path25_gui_tunnel_sapnw752sp4.sh
54 lines (49 loc) · 1.75 KB
/
25_gui_tunnel_sapnw752sp4.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
#!/usr/bin/env bash
# Starts an IAP TCP forwarding tunnel for SAP GUI
################################################################################
# INCLUDE FUNCTIONS
################################################################################
MY_INCLUDE='../inc/include.sh'
# ignore SC1090
# shellcheck source=/dev/null
if ! source "$MY_INCLUDE"; then
ME=$(basename "$0")
BASE_PATH=$(dirname "$0")
echo;echo "× Can not read required include file '$MY_INCLUDE'";echo
echo " Please start the script directly in the directory:"
echo " cd $BASE_PATH && bash $ME";echo
exit 9
fi
################################################################################
# MAIN
################################################################################
clear
# ASCII art title
tput setaf 4 0 0 # 4 = blue
echo_equals
cat << EOF
_____ _____ _____ _ _ _____
/ ____| /\ | __ \ / ____| | | |_ _|
| (___ / \ | |__) | | | __| | | | | |
\___ \ / /\ \ | ___/ | | |_ | | | | | |
____) / ____ \| |______| |__| | |__| |_| |_ _
|_____/_/ \_\_|__ __\_____|\____/|_____|| |
| |_ _ _ __ _ __ ___| |
| | | | | '_ \| '_ \ / _ \ |
| | |_| | | | | | | | __/ |
|_|\__,_|_| |_|_| |_|\___|_|
EOF
echo_equals
tput sgr0 # reset terminal
echo_info "Tunnel local IP '$MY_GUI_LOCAL' port 3200 to '$MY_GCP_GCE_NAME' port 3200 for SAP GUI"
echo
echo
echo "Connect to '$MY_GCP_GCE_NAME' via SAP GUI:"
echo "> sapgui $MY_GUI_LOCAL 00"
echo
echo_info "Exit with [Ctrl] + [C]"
echo
gcloud compute start-iap-tunnel "$MY_GCP_GCE_NAME" 3200 \
--local-host-port="$MY_GUI_LOCAL:3200" \
--zone="$MY_GCP_ZONE" \
--project="$MY_GCP_PROJECT"