in Web and Tech

Wget Usage

GNU.org describes wget to be a free software package for retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols. It is a non-interactive commandline tool, so it may easily be called from scripts, cron jobs, terminals without X-Windows support, etc.

This post describes personal experiences in dealing with the software.

For more about wget, visit the official wget site.

1. Cron jobs. In many web applications I’ve written and tinkered with that require scheduled execution (read: cron jobs), I’ve often used wget. I’d write a script and make it accessible by the system and call it using wget and the full URL to the script. Voila! Alternatively, there’s also lynx and then you also have the option to call the script via the local machine path. But I guess I just got more used to wget.

Usage example:

~$ crontab -e
10 * * * * "wget http://ipordomainname:port/path/to/script/scriptname.php

Side note: Here’s a good article about Cron Jobs.
http://code.tutsplus.com/tutorials/scheduling-tasks-with-cron-jobs–net-8800

2. Downloading from a remote FTP site. Sometimes, GUI FTP apps like Filezilla, just won’t cut it. Don’t get me wrong, I like Filezilla, it’s just that GUI has an overhead which you’d feel when you’re trying to mirror an entire site from a remote FTP host to your local machine.

Usage example:

~$ wget -m --user username --password @ftp://ipordomainname:port/path/to/files/*

Write a Comment

Comment