-
Notifications
You must be signed in to change notification settings - Fork 25
/
entr-rclone
59 lines (57 loc) · 1.24 KB
/
entr-rclone
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
55
56
57
58
59
#!/bin/sh
##
# Sync files via the commands `entr` and `rclone`.
#
# Syntax:
#
# entr-rclone <dir> <service>
#
# Example:
#
# entr-rclone ~/foo dropbox
#
# See http://lpan.io/one-liner-dropbox-client/
#
#
# ## Make the script into a daemon
#
# For example you can create a systemd service file:
#
# ~/.config/systemd/user/dropbox.service
#
# Example file:
#
# [Unit]
# Description=Dropbox Daemon
#
# [Service]
# ExecStart=/home/lpan/sync_dropbox.sh
# Restart=always
#
# [Install]
# WantedBy=default.target
#
# Then you can manage the daemon with the following commands:
#
# # reload the service file
# systemctl --user daemon-reload
#
# # start the daemon
# systemctl --user start dropbox.service
#
# # start the daemon on login
# systemctl --user enable dropbox.service
#
# # inspect the status of the daemon
# systemctl --user status dropbox.service
#
# ## incron alternative
#
# Instead of using entr and systemd, you can use incron to
# watch for file changes, and use rclone in incrontab for syncing.
#
# See https://kanihal.wordpress.com/2018/12/21/incron-and-rclone-for-syncing-screenshots-to-google-drive/
##
dir="$1"
remote="$2"
find "$dir" | entr -r rclone sync -v "$dir" "$remote:org"