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

start-vnc: CLI option for server options

parent 7c776d32
No related branches found
No related tags found
No related merge requests found
......@@ -68,13 +68,14 @@ SVNC_USERNAME="$(id -un)"
#
# If your local vnc client is not in the search path or named
# differently (e.g. TurboVNC, macOS), then change this parameter.
SVNC_VNCVIEWER="vncviewer"
SVNC_CLIENT="vncviewer"
# Resolution of remote desktop window
# Server options
#
# This is just the initial resolution. Resizing the vncviewer window
# later should also work.
SVNC_GEOMETRY="1920x1200"
# More options for the vncserver. TurboVNC on A Mac may produce
# a 'javax.net.ssl.SSLHandshakeException' in this case adding
# ' -securitytypes none' to SVNC_SERVER_OPTIONS may help.
SVNC_SERVER_OPTIONS="-geometry1920x1200"
# Session run time in minutes
SVNC_RUNTIME=240
......@@ -96,7 +97,7 @@ SVNC_CONSTRAINT=""
# implementation of ssh which dosen't support public key auth among other
# things.
#
# readonly SVNC_VNC_OPTIONS="-extssh"
# readonly SVNC_CLIENT_OPTIONS="-extssh"
# Frontend host
#
......@@ -150,9 +151,9 @@ Available values for OPTION include:
-A acctcode acctcode of job
-C list constraint for feature selection
-g geometry initial geometry of vnc window
-n nodes number of nodes
-q qos job qos
-s options addidtional options for vncserver
-t time job runtime
-u username use username for login
-v path path to vncviewer program
......@@ -172,25 +173,25 @@ ssh_frontend () {
parse_options () {
local option
while getopts 'A:C:g:n:q:t:u:v:x:' option; do
while getopts 'A:C:n:q:s:t:u:v:x:' option; do
case ${option} in
A) SVNC_ACCTCODE="$OPTARG"
;;
C) SVNC_CONSTRAINT="$OPTARG"
;;
g) SVNC_GEOMETRY="$OPTARG"
;;
n) SVNC_NODES="$OPTARG"
;;
q) SVNC_QOS="$OPTARG"
;;
s) SVNC_SERVER_OPTIONS="$OPTARG"
;;
t) SVNC_RUNTIME="$OPTARG"
;;
u) SVNC_USERNAME="$OPTARG"
;;
v) SVNC_VNCVIEWER="$OPTARG"
v) SVNC_CLIENT="$OPTARG"
;;
x) SVNC_VNC_OPTIONS="$OPTARG"
x) SVNC_CLIENT_OPTIONS="$OPTARG"
;;
?) usage
exit 1
......@@ -200,12 +201,12 @@ parse_options () {
readonly SVNC_ACCTCODE
readonly SVNC_CONSTRAINT
readonly SVNC_GEOMETRY
readonly SVNC_SERVER_OPTIONS
readonly SVNC_QOS
readonly SVNC_RUNTIME
readonly SVNC_USERNAME
readonly SVNC_VNCVIEWER
readonly SVNC_VNC_OPTIONS
readonly SVNC_CLIENT
readonly SVNC_CLIENT_OPTIONS
if [[ -z ${SVNC_ACCTCODE} ]]; then
printf "ERROR: Please specify an acctcode.\n\n" >&2
......@@ -246,7 +247,7 @@ ${sbatch_resources}
#SBATCH --parsable
#SBATCH --dkrzepilog=0
cd \${HOME}
/opt/TurboVNC/bin/vncserver -fg -geometry "${SVNC_GEOMETRY}" -localhost -securitytypes none
/opt/TurboVNC/bin/vncserver -fg -localhost ${SVNC_SERVER_OPTIONS}
EOF
}
......@@ -292,15 +293,15 @@ main () {
-Nf \
"${SVNC_USERNAME}@${vnc_host}.dkrz.de";
local vnc_options
vnc_options="${SVNC_VNC_OPTIONS:-}"
local client_options
client_options="${SVNC_CLIENT_OPTIONS:-}"
if [[ ${SVNC_PASSWORD} = "true" ]]; then
echo "Fetching password from frontend."
ssh_frontend "cat .vnc/passwd" > vnc_passwd
vnc_options+=" -passwd vnc_passwd"
client_options+=" -passwd vnc_passwd"
fi
echo "Connecting vncviewer to ${vnc_host}.dkrz.de"
"${SVNC_VNCVIEWER}" ${vnc_options} :${vnc_display}
"${SVNC_CLIENT}" ${client_options} :${vnc_display}
}
main "$@"
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