playbooks/roles/ood-applications/files/bc_vmd/template/script.sh.erb (25 lines of code) (raw):
#!/usr/bin/env bash
<%-
require "yaml"
node_arrays = YAML.load_file("/etc/ood/config/apps/bc_desktop/config/node_arrays.yml")
slot_type = node_arrays.find { |slot_type| slot_type["name"] == context.target }
gpu_count = slot_type["gpuCount"].to_i
-%>
# Clean the environment
module purge
# Set working directory to home directory
cd "${HOME}"
#
# Launch Xfce Window Manager and Panel
#
source "<%= session.staged_root.join("xfce_kiosk.sh") %>"
#
# Start VMD
#
VMD_HOME_DIR="<%= context.vmd_home %>"
set -x
<%- if gpu_count > 0 -%>
xfce4-terminal -e "vglrun $VMD_HOME_DIR/bin/vmd" -T "VMD Terminal" --disable-server
<%- else -%>
xfce4-terminal -e "$VMD_HOME_DIR/bin/vmd" -T "VMD Terminal" --disable-server
<%- end -%>