This repository has been archived on 2022-02-20. You can view files and clone it, but cannot push or open issues/pull-requests.
2020-11-13 10:02:20 -08:00
|
|
|
#!/bin/bash
|
|
|
|
# depends on sshfs fuse for ssh
|
2020-11-20 15:53:16 -08:00
|
|
|
module_load filesystem
|
|
|
|
|
2020-11-13 10:02:20 -08:00
|
|
|
function smount(){
|
|
|
|
local HOST
|
|
|
|
HOST=$(sed 's/.*@\(.*\):.*/\1/' <<< "$1")
|
|
|
|
[[ ! $(host_reachable $HOST 22) ]] && echo host $HOST not reachable, aborting mount && return 1
|
|
|
|
if [[ $(mounted $2) ]]; then
|
|
|
|
echo "remote $1 already mounted at $2, aborting mount"
|
|
|
|
else
|
2020-11-20 15:53:16 -08:00
|
|
|
echo "mounting via ssh $*"
|
|
|
|
sshfs "$@" -o default_permissions
|
2020-11-13 10:02:20 -08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function usmount(){
|
2020-11-20 15:53:16 -08:00
|
|
|
if [[ $(mounted $1) ]]; then
|
2020-11-13 10:02:20 -08:00
|
|
|
echo "unmounting remote file system at $1"
|
|
|
|
fusermount -u $1
|
|
|
|
else
|
|
|
|
echo "nothing mounted at $1, aborting unmount"
|
|
|
|
fi
|
|
|
|
}
|