March 2024 | ||||||
Mo | Tu | We | Th | Fr | Sa | Su |
26 | 27 | 28 | 29 | 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 |
1 | 2 | 3 | 4 | 5 | 6 | 7 |
The command ls -lR >ls-lR stores a long recursive directory listing in the file ls-lR. FTP servers make these files once a day so a directory listing is ready to download whenever a mirror logs in. For gigabyte servers these files are several megabytes and are usually compressed to ls-lR.gz. Many mirrors still download ls-lR.gz daily, compare it with their own directory and then request the new files they want.
Many large archives now have ls-lR.gz about a megabyte and the average total size of the daily new files is similar. The bandwidth and (horror) charges for downloading the new files are increased by the size of the daily ls-lR.gz.
ls-lR.patch.gz is a compressed unified difference of the previous and the current ls-lR file. Mirror scripts and programs can download this file and patch a local copy of the remote server's ls-lR daily. ls-lR.patch.gz is sometimes only 1% of the size of ls-lR.gz.
ls-lR.times contains just the modification times of the previous and current ls-lR expressed as decimal seconds since the beginning of 1st January 1970 in the server's time zone. A mirror can download this 20 byte file first to check whether its local copy of the server's ls-lR can be patched with the ls-lR.patch.gz currently available or whether it needs to download a fresh ls-lR.gz.
mkls-lR makes the above files with careful attention to preserving and recording names and times. Mirrors can check the names and times against their local copy of the server's ls-lR before applying ls-lR.patch.gz as well as checking whether the patch fits. This ensures the mirror's ls-lR is aligned with the server's. mkls-lR does not make new ls-lR files unless there is a difference in the directories further saving in unnecessary mirror downloads.
Heavy server load increases ls runtime delaying ls-lR files until mirrors miss downloading them. mkls-lR can store new ls-lR files in /tmp for up to an hour before release at a precise time of day tod set with the -t option. The time mkls-lR starts should under normal load allow making of the final file ls-lR.times in the middle of the interval before tod. This prevents mirrors missing ls-lR files when server load is heavy even if mirroring starts only 1 minute after tod. A mirror using the timezone file with tod can set its start time precisely when appropriate.
mkls-lR makes and places the files as follows. If the file /etc/timezone is readable mkls-lR copies it to timezone in dirpath. It then makes ls-lR and ls-lR.patch.gz in the /tmp directory but relative to dirpath. If ls-lR is made before time of day tod its modification time is set to tod. After compressing ls-lR to ls-lR.gz, mkls-lR sets the modification time of ls-lR.gz equal to ls-lR. By default mkls-lR then deletes ls-lR but for the -a option it moves ls-lR to dirpath instead. mkls-lR makes ls-lR.times last. If tod has passed or at is unavailable, mkls-lR moves ls-lR.times, ls-lR.patch.gz and ls-lR.gz into dirpath immediately but otherwise asks at to move them at tod precisely.
mkls-lR is a bash script using GNU utilities intended for use on FTP servers with archives over 100 MB in size.
mirror-lslR.shtml describes how programs like Lee McLoughlin's perl script mirror can use ls-lR.patch.gz and ls-lR.times.