From 11e4e00b3464c75f6540ed74fa7bcf4663ec047c Mon Sep 17 00:00:00 2001 From: Michael Janczyk Date: Wed, 21 Apr 2010 20:18:30 +0200 Subject: clean exit and port redirect bugfix and cosmetics --- os-plugins/plugins/vmgrid/files/run-vmgrid.sh | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'os-plugins/plugins/vmgrid/files/run-vmgrid.sh') 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 -- cgit v1.2.3-55-g7522