1

I want to synchronize my files with Amazon Drive. I am using a Linux headless machine and thought about using Rclone for that. I am using rclone sync localdir remote:dir command to sync files local→remote but this is a one time sync.

How can I schedule a periodic (say, once a day) synchronization? Is cron a good way? Or does rclone provide its own mechanism? Will it work when I am not logged to the machine (it's always on)?

1 Answer 1

4

The way that I do it is with a cronjob. If it only runs once a day, you shouldn't have a problem with two instances trying to run, but you could always use flock to prevent that just in case:

0 23 * * * flock -n /some/lockfile rclone sync localdir remote:dir

Cron works whenever the machine is on, the user does not have to be logged on. You might, however, want to know/see a log of that task running. You can get the output of cron from:

grep CRON /var/log/syslog

but an easier/more consistent way might be to log the entire activity to a file like so:

0 23 * * * flock -n /some/lockfile rclone sync localdir remote:dir >> /var/log/myjob.log 2>&1

which will log both stderr and stdout in case you ever wanted to check on the job.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .