-
Notifications
You must be signed in to change notification settings - Fork 0
/
rclone-upload.sh
executable file
·31 lines (24 loc) · 984 Bytes
/
rclone-upload.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
#!/usr/bin/env bash
## Defaults
SOURCECLEARTEXT=/backup/data # name of directory that should be backed up
RCLONEREMOTE=crypt: # name of rclone remote to upload to
RCLONEULTYPE=check # type of upload. can be check, sync or copy
RCLONETRANSFERS=4 # amount of simultaneous uploads
## no need to change anything below
# if a config file has been specified with BACKUP_CONFIG=myfile use this one, otherwise default to config
BASE_PATH="$(dirname "$(readlink -f "$0")")"
if [[ ! -n "$BACKUP_CONFIG" ]]; then
BACKUP_CONFIG="$BASE_PATH/config"
fi
if [ -e $BACKUP_CONFIG ]; then
echo "using config from file: $BACKUP_CONFIG"
source "$BACKUP_CONFIG"
fi
# check dependencies
if [ ! "$(which rclone)" ]; then
echo "rclone is not installed"
exit 1
fi
RCLONECHECKERS=$(expr $RCLONETRANSFERS \* 4)
# script logic begins here
rclone --verbose --checksum --no-update-modtime --transfers=$RCLONETRANSFERS --checkers=$RCLONECHECKERS $RCLONEULTYPE $SOURCECLEARTEXT $RCLONEREMOTE