commit | author | age
|
64e605
|
1 |
#!/bin/sh |
JG |
2 |
|
|
3 |
cd /home/joel/OneDrive |
|
4 |
|
9af599
|
5 |
if [ "$1" = "sync" ]; then |
f7f566
|
6 |
echo Syncing |
JG |
7 |
BACKUP_DIR="/backup/work/" |
|
8 |
echo OneDrive Personal |
|
9 |
rclone sync $BACKUP_DIR "OneDrive_Personal":/Uni -P |
|
10 |
echo NextCloud |
|
11 |
rclone sync $BACKUP_DIR "NextCloud":/Uni -P |
|
12 |
echo GoogleDrive |
|
13 |
rclone sync $BACKUP_DIR "GoogleDrive":/Uni -P |
|
14 |
echo Mega |
|
15 |
rclone sync $BACKUP_DIR "Mega":/Uni -P |
|
16 |
echo unimelb |
|
17 |
rclone sync $BACKUP_DIR "unimelb":/ -P |
|
18 |
echo sout |
|
19 |
rclone sync $BACKUP_DIR "sout":/data/Cloud -P |
|
20 |
exit |
|
21 |
fi |
|
22 |
|
64e605
|
23 |
LAST="$(duplicacy list | tail -n1 | cut -d' ' -f4)" |
f7f566
|
24 |
CURR="$(duplicacy backup | tail -n1 | sed 's/[^0-9]//g')" |
64e605
|
25 |
#LAST=2 |
JG |
26 |
#CURR=4 |
|
27 |
DIFF="$(duplicacy diff -r $CURR -r $LAST | grep '-')" |
|
28 |
|
|
29 |
#echo "curr - $CURR" |
|
30 |
#echo "last - $LAST" |
|
31 |
#echo "diff - $DIFF" |
|
32 |
|
f7f566
|
33 |
duplicacy prune -keep 1:7 -keep 7:30 -exclusive > /dev/null 2>&1 |
64e605
|
34 |
|
f7f566
|
35 |
if [ -z "$DIFF" ]; then |
JG |
36 |
duplicacy prune -r $CURR -exclusive > /dev/null 2>&1 |
|
37 |
else |
|
38 |
echo "New backup $CURR" |
|
39 |
BACKUP_DIR="/backup/work/" |
|
40 |
rclone sync $BACKUP_DIR "OneDrive_Personal":/Uni & |
|
41 |
rclone sync $BACKUP_DIR "NextCloud":/Uni & |
|
42 |
rclone sync $BACKUP_DIR "GoogleDrive":/Uni & |
|
43 |
rclone sync $BACKUP_DIR "Mega":/Uni & |
|
44 |
rclone sync $BACKUP_DIR "unimelb":/ & |
|
45 |
rclone sync $BACKUP_DIR "sout":/data/Cloud & |
|
46 |
#rclone sync $BACKUP_DIR "Oracle":/Uni |
|
47 |
fi |