-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrclone_mount.sh
46 lines (42 loc) · 999 Bytes
/
rclone_mount.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
#!/bin/bash
src="n:/"
dest="/home/seedbox/torrents/deluge/mount"
if [[ "$#" == "1" ]]
then
if [[ "$1" == "-Q" || "$1" == "-q" || "$1" == "--quiet" ]]
then
verbose="0"
else
verbose="1"
fi
else
verbose="1"
fi
#unmounting directory (if already mounted)
#fusermount outputs nothing if directory was mounted
test=`fusermount -u "${dest}" 2>&1`
if [[ "$verbose" == "1" ]]
then
if [[ "$test" == "" ]]
then
echo "dir was mounted"
else
echo "dir was not mounted"
fi
echo "mounting dir"
fi
#mounting dir
rclone mount "${src}" "${dest}" --allow-other &
if [[ "$verbose" == "1" ]]
then
#wait for 5 seconds before checking if dir was succesfully mounted
sleep 5
if [[ `ls ${dest} | wc -l` != "0" ]]
then
echo "dir mounted"
else
echo "failed to mount dir"
exit 1
fi
fi
exit 0