Peter Glaeser

online and mobile affiliate marketing news

Downloading sites using WGET

Sometimes it is necessary to create offline versions of a page or a complete website. For example you might want to put an offline version of a site on your USB stick for a presentation. Or perhaps you need to create static backups of your site.

Today I’m going to describe how to download pages and/or complete sites onto your linux server or desktop computer. wget is the Linux command you’re looking for and here is how to use it:

Downloading a single file (without linked elements such as images):
wget http://www.google.com

Downloading a complete page (including linked elements such as images):
wget -p http://www.google.com

Downloading multiple complete pages (up to 7 levels):
wget -rkpl 7 http://www.google.com

Downloading (mirroring) a whole site (up to 10 levels):
wget -m 10 http://www.google.com

  • 0 Comments
  • Filed under: Technology
  • Backup Scripts for Your Server

    In a previous comment I was asked to post a backup procedure that I use on my root servers. The following is a backup stategy that I use on my SuSE servers.

    Backup directories

    You create the following directories:

    • /root/backup/scripts
    • /root/backup/files

    Hourly backup script

    Create /root/backup/scripts/1h.sh with the following contents and make it executable:
    tar -czf /root/backup/files/partial_`date +%Y-%m-%d_%H-%M`.tar.gz `find /etc /home /srv /var -type f -mmin -60` 2> /dev/null
    find /root/backup/files -name 'partial*' -mtime +7 -exec unlink '{}' \;

    This creates backups of files that were changed in the past 60 minutes. Also it deletes those hourly backups that are older than 7 days.

    Daily backup script

    Create /root/backup/scripts/1d.sh with the following contents and make it executable:
    rm /root/backup/files/complete*
    tar -czf /root/backup/files/complete.tar.gz /etc/ /home/ /srv/ /var/ 2> /dev/null
    lftp ftp://#username#:#password#@#host# -e "put /root/backup/files/complete.tar.gz; quit"

    This creates a full daily backup of the important files of your server. That complete backup is then copied to an external FTP server. That way you can access your backup even if the whole machine becomes inaccessible. You may need to install the lftp program if it’s not on your machine by default.

    You don’t need to create separate MySQL dumps. The MySQL data are stored in the /var structure, in my case under /var/lib/mysql/#database#.

  • 1 Comment
  • Filed under: Technology
  • watching two girls undress while working on a laptop in the park.
    Follow me on Twitter