Syncthing scheduled folder scan (scheduled backups)
654
This is a python script that makes scheduled GET requests on the SCAN api (https://docs.syncthing.net/rest/db-scan-post.html) for scanning all folders, or specified folders.
Syncthing and Syncthing-Scheduler in the same docker environment, than use a user-defined bridge network .If you'd like for the sync to happen at a certain time (we are assuming that all machines running Syncthing are not frequently restarting - since that will trigger automatic sync), then you need to disable the Watch for changes and set very high number in Full Rescan Interval (s). This way scanning on the folder will not be automatically executed. Now you can use this script to schedule when you'd like for the scan to take place - essentially making a scheduled backup at a certain time. So when the folder is scanned it will propagate the changes to all other machines.
The tag latest is multi-arch, so you can use it for any architecture.
config.yml and place it in a folder, that will be binded to a volume. Otherwise you cannot use this docker image.general_settings:
## MANDATORY. The URL you use to access the GUI. Note that if you are accessing the local syncthing instance, you need to have both containers be in the same docker network, and then just use the name of the syncthing container like http://syncthing:8384
# ex. http://192.168.100.2:8384 or https://sync.mydomain.com
url: <INSERT YOUR SYNCTHING GUI URL>
## MANDATORY. You syncthing API key
api_key: <INSERT YOUR SYNCTHING API KEY>
## DELETE if you want all of the folders to be scanned. Please note that the FOLDER ID should be placed here
folders_to_scan:
- 1xfxls-aa0
- 2xfxls-bb0
## DELETE THE ONE YOU DON'T NEED. This is the schedule when you want the script to run and call the Preview Generator commands
backup_schedule:
## DELETE IF NOT NEEDED
weekly:
## available values are MON, TUE, WED, THU, FRI, SAT, SUN.
day: <INPUT DAY HERE>
## Use HH:mm format and wrap the time in quatation marks e.g. "14:28"
time: <HH:mm>
## DELETE IF NOT NEEDED
daily:
## Use HH:mm format and wrap the time in quatation marks e.g. "14:28"
time: <HH:mm>
## DELETE IF NOT NEEDED. This schedule will run the preview generation command, on the specified day on the last week of the current month
last_day_of_month:
## available values are MON, TUE, WED, THU, FRI, SAT, SUN.
day: <INPUT DAY HERE>
## Use HH:mm format and wrap the time in quatation marks e.g. "14:28"
time: <HH:mm>
## DELETE THE ONE YOU DON'T NEED. If you have a PC where you will receive the backup files and it's not 24/7 turned on - you can add the mac address and a WOL packet will be sent
wake_on_lan_settings:
# ex. 01:02:03:0A:0B:0C
mac_address: <INSERT YOUR BACKUP PC MAC ADDRESS>
The config.yml can also be found here.
docker create \
--name=syncthing-scheduler \
-d \
-e TZ=Europe/London \
-p 1050:1050 \
-v /path/to/your/yaml/config/file:/yaml \
-v /var/run/docker.sock:/var/run/docker.sock \
--restart unless-stopped \
dokeraj/syncthing-scheduler:latest
| flag | Function |
|---|---|
-e TZ=Europe/London | Mandatory. Set it to your timezone. Note: If not set properly, the scheduled backup/update will not be ran at the specified time! |
-p 1050:1050 | Optional. If you run a monitoring tool like uptime-kuma, you can set it to listen to this port and it will return the latest response from the syncthing's scan API. |
-v /path/to/your/yaml/config/file:/yaml | Mandatory. This bind should point to where you have placed your config.yml file, so pihole-gravity-updater can read it on startup. |
-v /var/run/docker.sock:/var/run/docker.sock | Mandatory. This bind should be left as is, since it gives privileges in this container to access the docker server and create the WOL container to send a WOL packet. |
Note: This script is using the following docker image to send the WOL packet: r0gger/docker-wake-on-lan
Source code can be found here: Syncthing-Scheduler
Content type
Image
Digest
sha256:83feebc67…
Size
27.4 MB
Last updated
almost 3 years ago
docker pull dokeraj/syncthing-scheduler