Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

[Resolved] Cron job wget writing files to root directory - DesignLinux

Jul 06 2021
designlinux 0 Comments
[Resolved] Cron job wget writing files to root directory

Wget is command line utility for downloading files in Linux from web. Using wget utility you can trigger server side scripts using cron job. It also can be used to download files with FPT, HTTP, HTTPS protocols.

Problem#

When you use wget with cron job it will save the downloaded files under home directory. So it will create large number of junk files on your system.

Solution#

You should use the option -O with wget command to write the result file to specific file and location. After that select /dev/null device file as target file. It will ignore everything written to it. As a result, no junk files will be created in your home directory.

For example, below is the basic wget command:

wget http://releases.ubuntu.com/18.04/ubuntu-18.04.2-desktop-amd64.iso

You should change in above command to:

wget -q -O /dev/null http://releases.ubuntu.com/18.04/ubuntu-18.04.2-desktop-amd64.iso

Here:

  • -q Turn off wget command output
  • -O /dev/null Write downloaded content (file) to /dev/null device.

That’s it. Now the junk files will not be created anymore.

Conclusion#

Hope this tutorial helps you to avoid unwanted files on root generated by wget cron jobs. You can learn more about Wget visit the GNU wget Manual page.

Related

Tags: cron, cronjob, wget

How to Install Rocky Linux 8.4 Step by Step

Prev Post

How to Verify PGP Signature of Downloaded Software on Linux

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 1
  • 488
  • 612,667

DesignLinux.com © All rights reserved

Go to mobile version