diff --git a/roles/slurm-common/templates/slurm.epilog.j2 b/roles/slurm-common/templates/slurm.epilog.j2 index 0c059ae612df1d3e3d57ccf5c552f46b6a2fa50a..cf17ecebc1ed656ac6d65e37b81ad8faded948fa 100644 --- a/roles/slurm-common/templates/slurm.epilog.j2 +++ b/roles/slurm-common/templates/slurm.epilog.j2 @@ -6,6 +6,24 @@ find /tmp -user ${SLURM_JOB_USER} -name ".esd-*" | xargs rm -rf find /tmp -user ${SLURM_JOB_USER} -name ".X*-lock" | xargs rm -rf find /tmp/.X11-unix -user ${SLURM_JOB_USER} -name "X*" | xargs rm -rf +# NOTE: 20180316 The jobs above clean up the VNC session +# further clean up for Strudel Session +# X lock files are owned by root, so we need to find the right files to delete + + +# New Strudel session will create a file under user's home folder called xorg-jobid +# This file contains the display number that is assigned to xterm when it starts + +# Assigning variable and trimming the : from the display number +XSESSION=`cat /home/${SLURM_JOB_USER}/.vnc/xorg-${SLURM_JOB_ID} | tr -d :` + +# Formatting the filenames for the two files that we need to clean: /tmp/.X*-lock and /tmp/.X11/X* +XLOCKFILENAME=".X"$XSESSION"-lock" +XUNIXFILENAME="X"$XSESSION + +# Find the files and delete them +find /tmp/ -name $XLOCKFILENAME -exec rm -rf {} \; +find /tmp/.X11-unix -name $XUNIXFILENAME -exec rm -rf {} \; # echo 1 to drop page cache /bin/sync