lundi 28 septembre 2020

Download latest file using wget

I'm trying to figure out how to download the most recent file from a server using wget on my Linux system. The files are ssl certs in zip archives for some services i.e. prometheus.my.domain-09.28.2020, alertmanager.my.domain-09.28.2020, my.domain-07.28.2020, etc. The date of its addition to the server is nailed to the name of the file.Currently, i have python script that helps me to cope with the task, but due to the presence of crutches, I want to switch to bash. I achieved stdout and sed and saving to a txt file without html tags.

wget -qO- https://myserver@my.domain/ssl/ | sed -e 's/<[^>]*>//g' > downloaded_file.txt

The result of the command can be seen in the file:

prom.my.domain-2020-09-18.zip                   18-Sep-2020 18:14                7217
prom.my.domain-2020-09-21.zip                   21-Sep-2020 17:20                7217
grafana.my.domain-2020-09-18.zip                18-Sep-2020 18:14                7222
grafana.my.domain-2020-09-21.zip                21-Sep-2020 17:20                7222
my.domain-2020-09-18.zip                       18-Sep-2020 18:14                7269
my.domain-2020-09-21.zip                       21-Sep-2020 17:20                7269

How to download the latest grafana.zip now?




Aucun commentaire:

Enregistrer un commentaire