-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync.sh
More file actions
executable file
·38 lines (35 loc) · 818 Bytes
/
sync.sh
File metadata and controls
executable file
·38 lines (35 loc) · 818 Bytes
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
#!/bin/bash
#sincronises folders given in sync.txt with rclone
RCLONE_CONFIG=/home/misi/.config/rclone/rclone.conf
export RCLONE_CONFIG
LOCKFILE="/tmp/`basename $0`"
sync=$(cat /home/misi/.scripts/sync.txt)
IFS=$'\n'
for i in $sync
do
a=$(echo $i | awk '{print $1}')
b=$(echo $i | awk '{print $2}')
error=$(rclonesync $a $b)
ernum=$?
if [ $ernum -eq 2 ];then
echo "doing first sync"
rclonesync --first-sync $a $b
echo $?
echo "first sync done"
elif [ $ernum -eq 0 ];then
echo "ok"
elif [ $ernum -eq 1 ];then
echo -n "do you want to force sync (y/n)?"
read ans
if [ $ans = "y" ] || [ $ans = "Y" ];then
rclonesync --force $a $b
elif [ $ans = "n" ] || [ $ans = "N" ];then
echo "skipping"
else
echo "invalid input skipping"
fi
else
echo "error $ernum"
echo $error
fi
done