27 lines
618 B
Bash
Executable File
27 lines
618 B
Bash
Executable File
#!/bin/bash
|
|
# depends on sshfs fuse for ssh
|
|
module_load filesystem
|
|
|
|
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
|
|
echo "mounting via ssh"
|
|
echo sshfs "$@" -o default_permissions
|
|
mkdir -p $2
|
|
sshfs "$@" -o default_permissions
|
|
fi
|
|
}
|
|
|
|
function usmount(){
|
|
if [[ $(mounted $1) ]]; then
|
|
echo "unmounting remote file system at $1"
|
|
fusermount -u $1
|
|
else
|
|
echo "nothing mounted at $1, aborting unmount"
|
|
fi
|
|
}
|