Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F654870
~/bin/mount-user-fs
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
dereckson
Oct 6 2018, 00:03
2018-10-06 00:03:14 (UTC+0)
Size
700 B
Referenced Files
None
Subscribers
None
~/bin/mount-user-fs
View Options
#!/bin/sh
# Mount if needed
mount_sshfs
()
{
COMMAND
=
$1
SERVER
=
$2
SOURCE
=
$3
TARGET
=
$4
if
[
"
$COMMAND
"
=
"mount"
]
;
then
grep -qs
$TARGET
/proc/mounts
||
sshfs
$SERVER
:
$SOURCE
$TARGET
elif
[
"
$COMMAND
"
=
"umount"
]
;
then
grep -qs
$TARGET
/proc/mounts
&&
sudo umount
$FORCE
$TARGET
fi
}
# Command
COMMAND
=
mount
if
[
"
$1
"
=
"umount"
]
||
[
"
$1
"
=
"unmount"
]
;
then
COMMAND
=
"umount"
FORCE
=
""
test
"
$2
"
=
"-f"
&&
FORCE
=
"--force"
test
"
$2
"
=
"--force"
&&
FORCE
=
"--force"
fi
# Remount all points
mount_sshfs
$COMMAND
server1.domain.tld /some/remote/path /some/local/path
mount_sshfs
$COMMAND
server2.domain.tld /some/remote/path /another/local/path
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
198416
Default Alt Text
~/bin/mount-user-fs (700 B)
Attached To
Mode
P284 ~/bin/mount-user-fs
Attached
Detach File
Event Timeline
Log In to Comment