Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
ssh_scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sofiane Bendoukha
ssh_scripts
Commits
8496a35c
Commit
8496a35c
authored
7 years ago
by
Mathis Rosenhauer
Browse files
Options
Downloads
Patches
Plain Diff
Use ssh multiplexing
parent
b1cdd18e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
startvnc.sh
+28
-13
28 additions, 13 deletions
startvnc.sh
with
28 additions
and
13 deletions
startvnc.sh
+
28
−
13
View file @
8496a35c
...
...
@@ -14,8 +14,9 @@
# The vncviewer client has to support the -via option. TurboVNC,
# TigerVNC and TightVNC are known to work.
#
# You really should use publickey authentication. Otherwise you
# have to type your password many times.
# Set SSH_MUX=true to share one ssh connection. This can speed up the
# script if ssh login is slow. If you have to use password
# authentication, you will only have to give your password twice.
set
-e
...
...
@@ -28,8 +29,9 @@ readonly GEOMETRY="1920x1200" # resolution of remote desktop window
readonly
VNCVIEWER
=
/usr/bin/vncviewer
# path to local vncviewer
readonly
PASSWORD
=
true
# copy vncpassword temporarily to
# the local workstation
#readonly OPTIONS="-extssh" # uncomment this if you use
readonly
SSH_MUX
=
true
# use sharing of multiple ssh sessions
# over a single network connection
#readonly OPTIONS="-extssh" # uncomment this if you use
# TurboVNC as vncviewer
clean_up
()
{
...
...
@@ -55,6 +57,10 @@ clean_up () {
${
ssh_mistral
}
"cd .startvnc && rm -f
${
tmp_files
}
"
fi
if
[[
${
SSH_MUX
}
=
true
]]
;
then
ssh
${
ssh_options
}
-O
exit
${
mistral
}
fi
# Remove local vnc PasswordFile
if
[[
${
copy_password
}
=
true
]]
;
then
rm
-f
${
HOME
}
/vnc_passwd
...
...
@@ -83,7 +89,7 @@ do
;;
v
)
vncviewer
=
"
$OPTARG
"
;;
x
)
options
=
"
$OPTARG
"
x
)
vnc_
options
=
"
$OPTARG
"
;;
?
)
usage
exit
2
...
...
@@ -97,10 +103,15 @@ qos=${qos:-${QOS}}
runtime
=
${
runtime
:-${
TIME
}}
username
=
${
username
:-${
USERNAME
}}
vncviewer
=
${
vncviewer
:-${
VNCVIEWER
}}
options
=
${
options
:-${
OPTIONS
}}
mistral
=
"
${
username
}
@mistral.dkrz.de"
ssh_mistral_options
=
"-x"
ssh_mistral
=
"ssh
${
ssh_mistral_options
}
${
mistral
}
"
vnc_options
=
${
vnc_options
:-${
OPTIONS
}}
mistral
=
"
${
username
}
@mistral00.dkrz.de"
ssh_options
=
"-o ForwardX11=no"
if
[[
${
SSH_MUX
}
=
true
]]
;
then
ssh_options+
=
" -o ControlPath=~/.ssh/control:%h:%p:%r"
fi
ssh_mistral
=
"ssh
${
ssh_options
}
${
mistral
}
"
if
[[
-z
${
acctcode
}
]]
||
[[
-z
${
username
}
]]
;
then
printf
"ERROR: Please specify at least username and acctcode.
\n\n
"
>
&2
...
...
@@ -108,6 +119,10 @@ if [[ -z ${acctcode} ]] || [[ -z ${username} ]]; then
exit
2
fi
if
[[
${
SSH_MUX
}
=
true
]]
;
then
ssh
-MNf
${
ssh_options
}
${
mistral
}
fi
if
!
${
ssh_mistral
}
"test -s .vnc/passwd"
;
then
echo
"No VNC password found. Please set now."
${
ssh_mistral
}
-t
"salloc -Q -n1 -pgpu -A
${
acctcode
}
-- /bin/bash -c
\
...
...
@@ -154,12 +169,12 @@ host_and_display=$(${ssh_mistral} "/bin/bash .startvnc/gethost.${job_id}")
vnc_host
=
${
host_and_display
%
:
*
}
vnc_display
=
${
host_and_display
#*
:
}
options+
=
" -via
${
username
}
@
${
vnc_host
}
.dkrz.de"
vnc_
options+
=
" -via
${
username
}
@
${
vnc_host
}
.dkrz.de"
if
[[
${
PASSWORD
}
=
true
]]
;
then
scp
-q
-o
"ForwardX11=no"
${
mistral
}
:.vnc/passwd
${
HOME
}
/vnc_passwd
options+
=
" -passwd
${
HOME
}
/vnc_passwd"
scp
-q
${
ssh_options
}
${
mistral
}
:.vnc/passwd
${
HOME
}
/vnc_passwd
vnc_
options+
=
" -passwd
${
HOME
}
/vnc_passwd"
fi
# Start VNC viewer
${
vncviewer
}
${
options
}
:
${
vnc_display
}
${
vncviewer
}
${
vnc_
options
}
:
${
vnc_display
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment