Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what's the purpose of the '--delete-after' option of wget?

Tags:

wget

I came across the "--delete-after" option when I was reading the manpage of wget ? what's the purpose of providing such an option ? Is it just for testing the page is ok for downloading ? Or maybe there are other situations where this option is useful, I hope you guys may give me some hints.

like image 665
yorua007 Avatar asked Sep 03 '11 11:09

yorua007


People also ask

What is wget option?

wget [ option ]… [ URL ]… Wget will simply download all the URLs specified on the command line. URL is a Uniform Resource Locator, as defined below.

How does wget command work?

Wget is a networking command-line tool that lets you download files and interact with REST APIs. It supports the HTTP , HTTPS , FTP , and FTPS internet protocols. Wget can deal with unstable and slow network connections. In the event of a download failure, Wget keeps trying until the entire file has been retrieved.

What does wget flag do?

The [option] flag lets you specify the action to perform with the wget command. The [URL] flag points to the address of the directory, file, or webpage that you wish to download.


1 Answers

With reference to your comments above. I'm providing some examples of how we use it. We have a few websites running on Rackspace Cloud Sites which is a managed cloud hosting solution. We don't have access to regular cron.

We had an issue with runaway usage on a site using WordPress because WP kept calling wp-cron.php. To give you a sense of runaway usage, it used up in one day the allotted CPU cycles for a month. Anyway what I did was disable wp-cron.php being called within the WordPress system and manually call it through wget. I'm not interested in the output from the process so if I don't use --delete-after with wget (wget ... > /dev/null 2>&1 works well too) the folder where wget runs would get filled with hundreds of useless logs and output of each time the script was called.

We also have SugarCRM installed and that system requires its cron script to be called to handle system maintenance. We use wget silently for that as well. Basically a lot of these kinds of web-based systems have cron scripts. If you can't call your scripts directly say using php on the machine then the other option is calling it silently with wget.

The command to call these cron scripts is quite basic - wget --delete-after http://example.com/cron.php?parameters=if+needed

like image 141
arunkumar Avatar answered Oct 09 '22 21:10

arunkumar