SYNOPSISmkls-lR -d dirpath [-a] [-n basename] [-t tod] [-h] [--help] [-V] [--version] [ ] [-Ipath ...] [path ...] [ ]
DESCRIPTIONmkls-lR creates or updates the four files timezone, ls-lR.gz, ls-lR.patch.gz amd ls-lR.times in the directory dirpath. With the -a option a fifth file ls-lR is included. More than the disk space of ls-lR is briefly used in /tmp.
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.
EXAMPLESmkls-lR would normally be started by cron shortly before it is desired mirrors should log in. For these examples to work cron must have write permission to the dirpath subdirectory path argument. If you have more than one of these commands you should put them in a shell script and start the script with cron.
- 50 20 * * * /usr/bin/mkls-lR -d /home/ftp/pub -t 21:00
At 8:50 pm local time start making the
Move them to
where mirrors can download them at 9:00 pm precisely.
- mkls-lR -d /home/ftp/pub -Ils-lR.*
and do not include them in the listing. This stops any badly
configured mirrors from downloading the
- mkls-lR -d /home/ftp/tex-archive -Ils-lR.* -IFILES.by*
Include in the listing neither
A common fault of CTAN mirrors is downloading daily the 12 MB of index
files mentioned. A mirror using these
files cannot make that mistake.
- mkls-lR -d /home/ftp/pub/debian -n ls-lR_stable\ dists/slink/*
so the output filenames become
Only subdirectories matching
and their contents are listed so a mirror using the above files will
only download these. This example may be obsolete when you read this
immediately after compression.
Default: Delete after compression.
- -d dirpath
Make the files
relative to directory
Move them into
Write permission to
- -n basename
in each of the output file names
- -t tod
at a time of day
not more than 1 hour after
starts. The modification times of
are set to
it moves when created.
must be a single word
is in the format
An example for testing is
To release files at 5 minutes past midnight tomorrow use
- -h, --help
Display help message then exit.
expand special pattern characters
relative to directory
Default: Expand relative to current default directory.
is a shell pattern of files or directories not to appear in
is a shell pattern of files or directories to appear in
Default: All files in and below
- -V, --version
Display version and copyright message then exit.
AUTHORIan Maclaine-cross 31st August 1999