mandarons / icloud-docker

Dockerized iCloud Client - make a local copy of your iCloud documents and photos, and keep it automatically up-to-date.
BSD 3-Clause "New" or "Revised" License
1.07k stars 50 forks source link

[FEATURE] Schedule sync #233

Open Verkhovskyi opened 2 months ago

Verkhovskyi commented 2 months ago

As the one who sleeps in the same room where the server lives, I think it would be nice to be able to set a schedule of synchronization :)

For example, I'd like to allow sync and downloads only on weekdays 8:00 am to 5:00 pm

mandarons commented 2 months ago

This can be achieved through something like cron. If you set sync_interval to -1, it will sync once and exit (more info: #35). You can set cron schedule to run the docker container with sync_interval set to -1 in config.yaml.

Verkhovskyi commented 2 months ago

35 is about manual one-time usage, which is nice to have as an option, but very different from subject

mandarons commented 1 month ago

You can combine the one time usage option with a cronjob. For example, below are the two cron jobs that help achieve what you want:

Start the Docker container at 8 AM on weekdays: 0 8 * * 1-5 /usr/bin/docker container start icloud

and

Stop the Docker container at 5 PM on weekdays: 0 17 * * 1-5 /usr/bin/docker container stop icloud

Add these two to crontab using crontab -e and you're good to go.

tymmej commented 1 month ago

sync_interval to -1 does not work currently, see #247