summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
diff options
context:
space:
mode:
Diffstat (limited to 'os-plugins/plugins/vmgrid/files/run-vmgrid.sh')
-rw-r--r--os-plugins/plugins/vmgrid/files/run-vmgrid.sh25
1 files changed, 15 insertions, 10 deletions
diff --git a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
index 4fdd4af0..9b9adb44 100644
--- a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
+++ b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
@@ -49,6 +49,17 @@ writelog () {
echo -e "$1" >> ${vmgrid_rwmnt}/logs/run-vmgrid.${USER}.$$.log
}
+# remove config dirs when exit
+cleanexit () {
+ if echo "${RMDIRS}" 2>/dev/null | grep -q ${vmgrid_virt}; then
+ writelog "${vmgrid_virt} exited. Cleanning up... \c"
+ rm -rf ${RMDIRS} >/dev/null 2>&1
+ writelog "done"
+ fi
+
+ exit "$1"
+}
+
################################################################################
### Get XML file and dir
################################################################################
@@ -349,6 +360,7 @@ ide="TRUE"
scsi="FALSE"
hddrv="ide"
audio="false"
+remotedesktopport="590${VM_ID}"
# add rw share
sharepath="${vmgrid_rwmnt}/folders/${vm_shortname}"
@@ -384,7 +396,7 @@ fi
if [ ${headless} -eq 0 ]; then
if [ -z "${VIRTCMD}" ]; then
writelog "Grapical mode not available, exiting!"
- exit 1
+ cleanexit 1
fi
writelog "Starting ${vmgrid_virt} in graphical mode..."
${VIRTCMD} ${VIRTCMDOPTS} 2>/dev/null
@@ -394,7 +406,7 @@ elif [ -n "${VIRTCMDHL}" ]; then
${VIRTCMDHL} ${VIRTCMDOPTSHL} 2>/dev/null
else
writelog "${vmgrid_virt}: No headless mode defined, exiting!"
- exit 1
+ cleanexit 1
fi
# postrun for scripts after virtualization finishes
@@ -402,12 +414,5 @@ if [ -n "${POSTRUN}" ]; then
eval ${POSTRUN} >/dev/null 2>&1
fi
-# remove config dirs when finished
-if echo "${RMDIRS}" 2>/dev/null | grep -q ${vmgrid_virt}; then
- writelog "${vmgrid_virt} exited. Cleanning up... \c"
- rm -rf ${RMDIRS} >/dev/null 2>&1
- writelog "done"
-fi
-
-echo -e "Bye."
+cleanexit 0
exit 0