Skip to content

Commit c6d7224

Browse files
committed
Print current time before SSH
1 parent 01b0714 commit c6d7224

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ssh-oci-bastion.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ ENVIRONMENT
6262
ProxyJump
6363
\`\`\`
6464
65-
v2.0.3 May 2023 Created by Dima Korobskiy
65+
v2.1.0 May 2023 Created by Dima Korobskiy
6666
Credits: George Chacko, Oracle
6767
HEREDOC
6868
exit 1
@@ -126,7 +126,7 @@ done
126126
readonly MAX_TTL=$((3 * 60 * 60))
127127
readonly CHECK_INTERVAL_SEC=5
128128
# Intermittent `Permission denied (publickey)` errors might occur when trying to ssh immediately after session creation
129-
readonly AFTER_SESSION_CREATION_WAIT=10
129+
readonly AFTER_SESSION_CREATION_WAIT=5
130130

131131
# Determine which keypair ssh uses by default.
132132
# The default key order as of OpenSSH 8.1p1m (see `ssh -v {destination}`)
@@ -144,7 +144,7 @@ if [[ ! $SSH_PUB_KEY ]]; then
144144
fi
145145

146146
if [[ $port ]]; then
147-
echo -e "\nCreating a port forwarding tunnel for the port $port: this can take up to 20s to succeed ..."
147+
echo -e "\nCreating a port forwarding tunnel for the port $port: this can take 15-25s ..."
148148
# `--session-ttl`: session duration in seconds (defaults to 30 minutes, maximum is 3 hours).
149149
# `--wait-interval-seconds`: state check interval (defaults to 30 seconds).
150150
# `--ssh-public-key-file` is required
@@ -166,7 +166,7 @@ if [[ $port ]]; then
166166
ssh_command="${ssh_command/<localPort>/localhost:$port}"
167167
sleep $AFTER_SESSION_CREATION_WAIT
168168

169-
echo -e "\nLaunching an SSH tunnel"
169+
echo -e "\n$(date +'%T %Z') Opening an SSH tunnel. Interrupt (Ctrl+C) the process to close it."
170170
set -x
171171
# This only works assuming there are no internal quotes in the command
172172
$ssh_command
@@ -175,7 +175,7 @@ if [[ $port ]]; then
175175
fi
176176

177177
if [[ $HOST_USER ]]; then
178-
echo -e "\nCreating a bastion session: this can take up to 1m:30s to succeed..."
178+
echo -e "\nCreating a bastion session: this can take 1m:15s-1m:30s ..."
179179
# `--session-ttl`: session duration in seconds (defaults to 30 minutes, maximum is 3 hours).
180180
# `--wait-interval-seconds`: state check interval (defaults to 30 seconds).
181181
# `--ssh-public-key-file` is required
@@ -223,7 +223,7 @@ HEREDOC
223223
fi
224224
sleep $AFTER_SESSION_CREATION_WAIT
225225

226-
echo -e "\nSSH to the target instance via a jump host"
226+
echo -e "\n$(date +'%T %Z') SSH to the target instance via a jump host"
227227
set -x
228228
ssh "${HOST_USER}@${OCI_INSTANCE}"
229229
set +x

0 commit comments

Comments
 (0)