I am using the following command to update my TeXLive 2019 installation on Ubuntu (installed it from CTAN, not packages) on a weekly basis to keep my packages reasonably up to date:
sudo /usr/local/texlive/2019/bin/x86_64-linux/tlmgr update --self -all
This works as expected, even when called using a shell script (sudo /root/bin/updatetexlive):
#!/bin/bash
/usr/local/texlive/2019/bin/x86_64-linux/tlmgr update --self -all
However, when I invoke this using cron (sudo crontab -e):
20 23 * * sun /root/bin/updatetexlive
(Every Sunday at 11:20 PM.)
I get the cryptic error:
Unable to download the checksum of the remote TeX Live database, but found a local copy, so using that.
You may want to try specifying an explicit or different CTAN mirror, or maybe you need to specify proxy information if you're behind a firewall; see the information and examples for the -repository option at https://tug.org/texlive/doc/install-tl.html (and in the output of install-tl --help).
tlmgr: package repository http://ctan.math.utah.edu/systems/texlive/tlnet (not verified: u nknown) tlmgr: saving backups to /usr/local/texlive/2019/tlpkg/backups
As a matter of general rule, when something fails in cron when it works on the command line, usually an environment variable related to the calling shell is at fault. So, I looked in my list of export's on the commandline, and found three possible variables. I set them in the crontab:
PATH="/usr/local/texlive/2019/bin/x86_64-linux:/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
TEXMFDIST="/usr/local/texlive/2019/texmf-dist"
SHELL=/bin/bash
However, I still get the error above. How do I make tlmgr run as a cron job?