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
429c5f63
Commit
429c5f63
authored
8 years ago
by
Mathis Rosenhauer
Browse files
Options
Downloads
Patches
Plain Diff
ForwardX11=no
parent
af0b2312
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
+14
-12
14 additions, 12 deletions
startvnc.sh
with
14 additions
and
12 deletions
startvnc.sh
+
14
−
12
View file @
429c5f63
...
...
@@ -35,21 +35,21 @@ clean_up () {
local
tmp_files
=
${
job_script
}
if
[[
${
vnc_host
}
]]
;
then
ssh
${
mistral
}
"ssh
${
vnc_host
}
\
${
ssh
_
mistral
}
"ssh
${
vnc_host
}
\
\"
/opt/TurboVNC/bin/vncserver -kill :
${
vnc_display
}
\"
"
fi
echo
"Removing job and temporary files."
if
[[
${
job_id
}
]]
;
then
tmp_files
=
"
${
tmp_files
}
out.
${
job_id
}
gethost.
${
job_id
}
"
ssh
${
mistral
}
"scancel -Q
${
job_id
}
; sleep 1"
${
ssh
_
mistral
}
"scancel -Q
${
job_id
}
; sleep 1"
else
echo
"Job ID not available. Make sure the vncjob is not running!"
ssh
${
mistral
}
"squeue -u
${
username
}
"
${
ssh
_
mistral
}
"squeue -u
${
username
}
"
fi
if
[[
${
tmp_files
}
]]
;
then
ssh
${
mistral
}
"cd .startvnc && rm -f
${
tmp_files
}
"
${
ssh
_
mistral
}
"cd .startvnc && rm -f
${
tmp_files
}
"
fi
# Remove local vnc PasswordFile
...
...
@@ -96,6 +96,8 @@ 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
}
"
if
[[
-z
${
acctcode
}
]]
||
[[
-z
${
username
}
]]
;
then
printf
"ERROR: Please specify at least username and acctcode.
\n\n
"
>
&2
...
...
@@ -103,17 +105,17 @@ if [[ -z ${acctcode} ]] || [[ -z ${username} ]]; then
exit
2
fi
if
!
ssh
${
mistral
}
"test -s .vnc/passwd"
;
then
if
!
${
ssh
_
mistral
}
"test -s .vnc/passwd"
;
then
echo
"No VNC password found. Please set now."
ssh
-t
${
mistral
}
"salloc -Q -n1 -pgpu -A
${
acctcode
}
-- /bin/bash -c
\
${
ssh
_
mistral
}
-t
"salloc -Q -n1 -pgpu -A
${
acctcode
}
-- /bin/bash -c
\
'ssh -tt
\$
SLURM_JOB_NODELIST -- /opt/TurboVNC/bin/vncpasswd'"
fi
trap
clean_up INT QUIT TERM ERR EXIT
job_script
=
$(
ssh
${
mistral
}
\
job_script
=
$(
${
ssh
_
mistral
}
\
"mkdir -p .startvnc && cd .startvnc && mktemp vncjob.XXXXX"
)
ssh
${
mistral
}
"cat > .startvnc/
${
job_script
}
"
<<
EOF
${
ssh
_
mistral
}
"cat > .startvnc/
${
job_script
}
"
<<
EOF
#!/bin/bash
#SBATCH --partition=gpu
#SBATCH --ntasks=12
...
...
@@ -128,9 +130,9 @@ cd \${HOME}
EOF
echo
"Submitting vncserver job."
job_id
=
$(
ssh
${
mistral
}
"cd .startvnc && sbatch
${
job_script
}
"
)
job_id
=
$(
${
ssh
_
mistral
}
"cd .startvnc && sbatch
${
job_script
}
"
)
ssh
${
mistral
}
"cat > .startvnc/gethost.
${
job_id
}
"
<<
EOF
${
ssh
_
mistral
}
"cat > .startvnc/gethost.
${
job_id
}
"
<<
EOF
#!/bin/bash
LOGFILE=
\$
{HOME}/.startvnc/out.
${
job_id
}
while [[ -z
\$
{host_and_display} ]]; do
...
...
@@ -144,14 +146,14 @@ echo \${host_and_display}
EOF
echo
"Waiting for job
${
job_id
}
to start."
host_and_display
=
$(
ssh
${
mistral
}
"/bin/bash .startvnc/gethost.
${
job_id
}
"
)
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"
if
[[
${
PASSWORD
}
=
true
]]
;
then
scp
-q
${
mistral
}
:.vnc/passwd
${
HOME
}
/vnc_passwd
scp
-q
-o
"ForwardX11=no"
${
mistral
}
:.vnc/passwd
${
HOME
}
/vnc_passwd
options+
=
" -passwd
${
HOME
}
/vnc_passwd"
fi
...
...
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