Skip to content

Commit

Permalink
Added mount-farm script.
Browse files Browse the repository at this point in the history
Added mount-farm.sh script to make it easier for users to mount /nfs /lustre and /warehouse to their instance. The script is copied to /usr/local/bin during post start tasks and can be run just by typing 'mount-farm'.
  • Loading branch information
prete committed Nov 19, 2019
1 parent 831c5ca commit 92506fe
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,6 @@ COPY files/notebooks /home/jovyan/notebooks

# copy mount script
COPY mount-farm.sh /
RUN sudo chmod +x /mount-farm.sh
RUN sudo mv /mount-farm.sh /usr/local/bin/mount-farm

# copy poststart script
COPY poststart.sh /
20 changes: 20 additions & 0 deletions mount-farm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

MOUNTED_DIRS=$(mount | grep sshfs | awk '{print $3}' | grep -E "^(/nfs|/lustre|/warehouse)$")
if [[ ! -z ${MOUNTED_DIRS} ]];
then
echo "[+] Unmounting previous mounted folders ($(echo $MOUNTED_DIRS | paste -sd "," -))"
sudo umount ${MOUNTED_DIRS}
fi

read -p "[>] Input your farm user: " SANGER_USER
read -sp "[>] Input your farm password: " SANGER_PASSWORD
echo ""
echo "[+] Mounting:"
for MOUNT_POINT in /nfs /lustre /warehouse; do
echo -e "\t- ${MOUNT_POINT}"
if [ ! -d "$MOUNT_POINT" ]; then
sudo mkdir -p ${MOUNT_POINT}
fi
echo "${SANGER_PASSWORD}" | sudo sshfs -o password_stdin,allow_other,auto_unmount,no_remote_lock,StrictHostKeyChecking=no ${SANGER_USER}@farm4-login:${MOUNT_POINT} ${MOUNT_POINT}
done
3 changes: 3 additions & 0 deletions poststart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ sudo mkdir -p /nfs
sudo mkdir -p /lustre
sudo mkdir -p /warehouse

sudo chmod +x /mount-farm.sh
sudo cp /mount-farm.sh /usr/local/bin/mount-farm

export USER=jovyan

0 comments on commit 92506fe

Please sign in to comment.