Skip to content
Snippets Groups Projects
Commit 429c5f63 authored by Mathis Rosenhauer's avatar Mathis Rosenhauer
Browse files

ForwardX11=no

parent af0b2312
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment