-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-rclone.sh
executable file
·45 lines (37 loc) · 1 KB
/
run-rclone.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
#!/bin/bash
# set -n # Uncomment to check your syntax, without execution.
# set -x # Uncomment to debug this shell script
# Usage:
# $ ./run-rclone.sh -s="~/path/to/src" -d="your_remote_name:path/to/dest" -l="./logs"
log_path="./"
for i in "$@"; do
case $i in
-s=*|--source=*)
source_path="${i#*=}"
shift # past argument=value
;;
-d=*|--destination=*)
destination_path="${i#*=}"
shift # past argument=value
;;
-l=*|--log=*)
log_path="${i#*=}"
shift # past argument=value
;;
*)
exit 1
;;
esac
done
timestamp="$(date +"%Y%m%d_%H%M%S")"
log_file_name="rclone-$timestamp.log"
log_file_path="$log_path/$log_file_name"
echo "$ pwd" >> "$log_file_path"
echo "$(pwd)" >> "$log_file_path"
echo >> "$log_file_path"
echo "$ rclone sync "$source_path" "$destination_path"" >> "$log_file_path"
rclone sync "$source_path" "$destination_path" >> "$log_file_path"
# Options:
# --copy-links
# --config ~/.config/rclone/rclone.conf
# --progress