Add a sleep after running the workspace mount process. It runs in background so the workspace risks to not be available before the user tries to use it.

This commit is contained in:
Andrea Dell'Amico 2019-03-01 18:31:11 +01:00
parent 6b3f9bb7c8
commit 54c9512e48
2 changed files with 7 additions and 0 deletions

View File

@ -11,6 +11,7 @@ r_connector_userconfig: userconfig.csv
r_connector_adduserscript: /usr/local/bin/rusersadd r_connector_adduserscript: /usr/local/bin/rusersadd
r_connector_workspace_unmount: /usr/local/bin/rconnector_unmount r_connector_workspace_unmount: /usr/local/bin/rconnector_unmount
r_connector_workspace_mountpoint: workspace r_connector_workspace_mountpoint: workspace
r_connector_sleep_after_mount: 5
r_connector_rstudio_cookie_key: /var/lib/rstudio-server/secure-cookie-key r_connector_rstudio_cookie_key: /var/lib/rstudio-server/secure-cookie-key
r_connector_rprofile_svn_url: 'http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/RConfiguration/RStudioConfiguration' r_connector_rprofile_svn_url: 'http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-analysis/RConfiguration/RStudioConfiguration'
r_connector_rprofile_filename: '.Rprofile' r_connector_rprofile_filename: '.Rprofile'

View File

@ -11,6 +11,7 @@ USER="$1"
GCUBE_TOKEN= GCUBE_TOKEN=
GCUBE_SCOPES= GCUBE_SCOPES=
REMOTE_WORKSPACE_MOUNT=0 REMOTE_WORKSPACE_MOUNT=0
SLEEP_AFTER_MOUNT={{ r_connector_sleep_after_mount }}
if [ $# -ne 3 ] ; then if [ $# -ne 3 ] ; then
REMOTE_WORKSPACE_MOUNT=1 REMOTE_WORKSPACE_MOUNT=1
logger "$LOG_PREFIX: this rconnector does not support the remote workspace mount" logger "$LOG_PREFIX: this rconnector does not support the remote workspace mount"
@ -35,6 +36,7 @@ workspace_mount () {
sudo /bin/mkdir -p "$WORKSPACE_MOUNT_DIR" sudo /bin/mkdir -p "$WORKSPACE_MOUNT_DIR"
sudo /bin/chown "${USER}" "$WORKSPACE_MOUNT_DIR" sudo /bin/chown "${USER}" "$WORKSPACE_MOUNT_DIR"
sudo -u "$USER" /usr/bin/java -jar $FUSE_INTEGRATION_JAR $GCUBE_TOKEN $GCUBE_SCOPES $WORKSPACE_MOUNT_DIR > "/var/tmp/workspace_${USER}.log" 2>&1 & sudo -u "$USER" /usr/bin/java -jar $FUSE_INTEGRATION_JAR $GCUBE_TOKEN $GCUBE_SCOPES $WORKSPACE_MOUNT_DIR > "/var/tmp/workspace_${USER}.log" 2>&1 &
sleep $SLEEP_AFTER_MOUNT
fi fi
} }
@ -44,6 +46,10 @@ fix_userconfig_perms () {
sudo /bin/chown "${USER}:{{ smartgears_user }}" "$HDIR/{{ r_connector_userconfig }}" sudo /bin/chown "${USER}:{{ smartgears_user }}" "$HDIR/{{ r_connector_userconfig }}"
sudo /usr/bin/setfacl -m u:${USER}:rw,g:{{ smartgears_user }}:rw $HDIR/{{ r_connector_userconfig }} sudo /usr/bin/setfacl -m u:${USER}:rw,g:{{ smartgears_user }}:rw $HDIR/{{ r_connector_userconfig }}
} }
#
# Main
#
if [ -d "$HDIR" ] ; then if [ -d "$HDIR" ] ; then
if id -u "$USER" >/dev/null 2>&1 if id -u "$USER" >/dev/null 2>&1
then then