-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsync.sh
executable file
·54 lines (43 loc) · 1.71 KB
/
sync.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
#!/bin/bash
while getopts aoip flag
do
case "${flag}" in
a) backupAll=true;;
r) backupRadarr=true;;
s) backupSonarr=true;;
l) backupLidarr=true;;
p) backupProwlarr=true;;
b) backupBazarr=true;;
esac
done
declare -A listOfDirs
rcloneConfig=/home/florian/.config/rclone/rclone.conf
rcloneOptions="-v --ignore-checksum --ignore-size --local-no-check-updated"
echo $(date +"%Y-%m-%d %H:%M:%S") starting backup
if [[ $backupAll = true || $backupRadarr = true ]]; then
echo $(date +"%Y-%m-%d %H:%M:%S") setting radarr backup folder to ${listOfDirs[radarr]}
listOfDirs[radarr]=/var/lib/radarr/Backups/scheduled
fi
if [[ $backupAll = true || $backupSonarr = true ]]; then
echo $(date +"%Y-%m-%d %H:%M:%S") setting sonarr backup folder to ${listOfDirs[sonarr]}
listOfDirs[sonarr]=/var/lib/sonarr/Backups/scheduled
fi
if [[ $backupAll = true || $backupLidarr = true ]]; then
echo $(date +"%Y-%m-%d %H:%M:%S") setting lidarr backup folder to ${listOfDirs[lidarr]}
listOfDirs[lidarr]=/var/lib/lidarr/Backups/scheduled
fi
if [[ $backupAll = true || $backupProwlarr = true ]]; then
echo $(date +"%Y-%m-%d %H:%M:%S") setting prowlarr backup folder to ${listOfDirs[prowlarr]}
listOfDirs[prowlarr]=/var/lib/prowlarr/Backups/scheduled
fi
if [[ $backupAll = true || $backupBazarr = true ]]; then
echo $(date +"%Y-%m-%d %H:%M:%S") setting bazarr backup folder to ${listOfDirs[bazarr]}
listOfDirs[bazarr]=/opt/bazarr/config/backup
fi
for dir in "${!listOfDirs[@]}"
do
:
echo $(date +"%Y-%m-%d %H:%M:%S") backing up $dir - ${listOfDirs[$dir]}
rclone $rcloneOptions --config=$rcloneConfig sync ${listOfDirs[$dir]} gdrive:/backups/$dir
done
echo $(date +"%Y-%m-%d %H:%M:%S") backup completed