0

I have a direct link to a file (PDF) on the WWW. The file is updated every day. I would like to download it every day in order to keep track of the changes. What's the easiest way to do this automatically with linux? (actually Ubuntu 14 or later) In the best case, I don't even notice it happening.

The method should include a check whether the online file has a newer date since the last download. The computer is almost permanently connected to the internet and shutdown after each use.

Scott Manley
  • 155
  • 8
  • Have you tried something? Or at least searching for something? – Michal Polovka Jan 09 '18 at 15:11
  • Like what? There is nothing on this topic on askubuntu, something related to Windows on stackoverflow, etc. not really what I am looking for. Do you have a suggestion? – Scott Manley Jan 09 '18 at 15:24
  • https://blog.azuresky.ca/blog/2012/01/zsync-client-side-rsync-over-http/ – Panther Jan 09 '18 at 15:27
  • [https://www.linuxnix.com/18-curl-command-examples/](https://www.linuxnix.com/18-curl-command-examples/) has examples of using curl with a "modified later than date" format, and [https://stackoverflow.com/a/15374813](https://stackoverflow.com/a/15374813) gets yesterdays date... – Charles Green Jan 09 '18 at 15:43

1 Answers1

0

As suggested in the comments to your questions you can fetch the file with cURL (esp. the link suggested by Charles Green).

What is now missing, is the scheduling part. With Linux you can use cron or anacron. (https://help.ubuntu.com/community/CronHowto and Confused about relationship between cron and anacron).

Regardlessly of the scheduler you need a little wrapper script to perform the actual download with curl (as suggested above). This script is than called by cron/anacron on a regular basis (once a day, every hour, ...).

This way you can check if your download script is working correctly by starting it manually before it is started automatically by (ana)cron.

In your case (almost always connected but shutdown after use) I would recommend configuring anacron with a daily schedule, so that your script gets executed exactly once a day, every day you start your computer.

Stefan
  • 326
  • 1
  • 4