ansible-roles/smartgears/r_connector/templates/rconnector_unmount

19 lines
647 B
Plaintext
Raw Normal View History

#!/bin/bash
WORKSPACE_USER=$1
RETVAL=0
RCONNECTOR_WORKSPACE_MOUNTPOINT="{{ r_connector_workspace_mountpoint }}"
MOUNT_WORKSPACE_PID=$( ps auwwx | grep -i java | grep "$WORKSPACE_USER" | grep "$RCONNECTOR_WORKSPACE_MOUNTPOINT" | grep -v sudo | awk '{print $2}' )
if [ ! -z "$MOUNT_WORKSPACE_PID" ] ; then
logger "rconnector_unmount: trying to unmount the workspace of the user $WORKSPACE_USER, pid $MOUNT_WORKSPACE_PID"
sudo /bin/kill -15 "$MOUNT_WORKSPACE_PID"
RETVAL=$?
logger "rconnector_unmount: umount result: $RETVAL"
else
logger "rconnector_unmount: no mounted workspace for the user $WORKSPACE_USER"
fi
exit $RETVAL