-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbackup-photos
executable file
·49 lines (44 loc) · 1.7 KB
/
backup-photos
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
#!/bin/bash
# This backup program will use rclone to upload the entire
# contents of my Plex directory to my encrypted remote.
# It will send a notification that the backup is starting
# before it is run. The rclone command will output the log
# into a file. rclone will only upload files that have
# changed. Any files that would be deleted or overwritten
# will be moved into a backup directory on the remote,
# allowing for versioning of the files. When finished, this
# will send a push notificaiton using pushover.com that will
# include a link to view the log file on the web.
# Create constants
PUSH_NOTIFICATION_DIRECTORY="/share/Web/bin/push_notifications/backups"
# Create a string like `2018-02-19_14:16:51`
datename="$(date '+%Y-%m-%d_%H:%M:%S')"
logfile="$datename.nutdrive.photos.log"
logfile2="$datename.gdrive.photos.log"
# The rclone executable
rclone="/share/Web/rclone/rclone"
# Send a starting notification
$PUSH_NOTIFICATION_DIRECTORY/push \
"Backup started" \
"Started backing up the Plex Photos directory.";
# Run rclone. This will run the rclone executable in
# `/share/Web`. It will use the the rclone config file.
# It will log info stats into the specified log file.
$rclone \
--config /share/Web/rclone/rclone.conf \
--log-file "/share/Web/rclone/logs/$logfile" \
--log-level INFO \
--stats-file-name-length 0 \
--exclude '.*{/**,}' \
--checkers 128 \
--transfers 32 \
copy \
/share/Photos/All\ Photos/ \
NutDrive:Backups/Photos
# Send a notification the backup finished, and include
# a link to view the log on the web
$PUSH_NOTIFICATION_DIRECTORY/push-url \
"Photo backup finished" \
"Finished backing up Plex Photos directory." \
"http://rclone-logs.grevells.duckdns.org/$logfile" \
"View log"