-
Notifications
You must be signed in to change notification settings - Fork 1
/
fmrilab_mount_kanbalam.sh
executable file
·94 lines (72 loc) · 1.42 KB
/
fmrilab_mount_kanbalam.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
# Defaults #####################
mountPoint=~/mnt/kanbalam
localUser=`whoami`
remoteDir=/global/home/lconcha_g/$1
server=kanbalam.supercomputo.unam.mx
################################3
remoteUser=$1
print_help()
{
echo "
`basename $0` remoteUser
Options:
-remoteUser <user> Default: $localUser
-mountPoint </some/local/path/where/I/Have/write/permissions>
Default: $mountPoint
-remoteDir <remotePath>
Default: ${remoteDir}/user
-server <address>
Default: $server
Luis Concha
INB
2012
"
}
if [ $# -lt 1 ]
then
echo " ERROR: Need more arguments..."
print_help
exit 1
fi
declare -i i
i=1
for arg in "$@"
do
case "$arg" in
-h|-help)
print_help
exit 1
;;
-remoteUser)
nextarg=`expr $i + 1`
eval remoteUser=\${${nextarg}}
;;
-mountPoint)
nextarg=`expr $i + 1`
eval mountPoint=\${${nextarg}}
;;
-remoteDir)
nextarg=`expr $i + 1`
eval remoteDir=\${${nextarg}}
;;
-server)
nextarg=`expr $i + 1`
eval server=\${${nextarg}}
;;
esac
i=$[$i+1]
done
if [ -d $mountPoint ]
then
echo "Mounting to $mountPoint ..."
else
echo "$mountPoint does not exist. Create then try again. Bye."
exit 1
fi
echo "--> sshfs -o reconnect $remoteUser@$server:$remoteDir $mountPoint"
sshfs -o reconnect $remoteUser@$server:$remoteDir $mountPoint
echo "
to unmount type:
fusermount -u $mountPoint
"