Improve rsync command in page "Running a Mirror"
On https://f-droid.org/en/docs/Running_a_Mirror/ the suggested raync command in crontab is currently listing as:
*/5 * * * * www-data /usr/bin/rsync --links --delete --times --recursive --permissions --hard-links --sparse --delay-updates --temp-dir /tmp/ ftp.fau.de::fdroid/repo/ /var/www/fdroid/fdroid/repo/
Which has something we can inprove:
- Invalid option
bluet@ncnu-ftp:~⟫ /home/bluet/bin/mirror-fdroid.sh rsync: --permissions: unknown option rsync error: syntax or usage error (code 1) at main.c(1572) [client=3.1.1]
- many options can be compiled and included in the
-a
option
- many options can be compiled and included in the
- The option
--delete
could break some client downloads- better to include
--delete-delay
to postpone the file deletion. (fetch and update first, then delete obsolete files after)
- better to include
- The
*/5
in crontab asks rsync to run every 5 minutes, which is a little bit too much, and might cause DDoS-like problem and drag down upstream mirror server performance (it will use a lot of CPU and Disk IO resources)
To conclude:
Replace some options with -a
, include --delete-delay
, reduce mirror frequency.
Edited by BlueT - Matthew Lien - 練喆明