Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.


Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.


Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.


Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Scripts, WordPress

WordPress Backup Script

Submitted by on October 23, 2009 – 1:04 pm 7 Comments

Whenever a new WordPress version comes out, I get an itch to upgrade as quickly as possible. Generally, this is not a good idea, unless you enjoy working out new software bugs and dealing with broken plugins. Still, sooner or later you still have to upgrade and there is always a chance that something will go terribly wrong. You always need to make a backup.

The WP-DB-Backup plugin is, shall we say, an industry-standard tool for backing up WordPress database. A full backup needs to be performed prior to upgrading WordPress. You should also backup the database before adding, removing or upgrading any plugins. However, the database backup is just the first half of the process: you also need to back up your WordPress installation, along with all your plugins, themes and configuration files.

Below is the script that will created a compressed tarball of your entire WordPress installation directory (but of not the database). The resulting file may be quite large, depending on how much stuff you uploaded to your site. You will need to modify these two variables: $WORKDIR and $WWWHOME. With most hosting providers, your WordPress installation will be located in /home/your_username/public_html. You will also need to create the backup directory: /home/your_username/backups

Do not forget to cleanup old backup files once in a while, otherwise you may run out of disk space allocated by your hosting provider.

Print Friendly, PDF & Email


  • Avatar Dark_LovexXx says:

    What Free web hosting with sub domain is the best…?

    post now

  • Avatar stealspartansbcglobalnet says:

    I am on a Journalism degree and it’s essential for us to keep a blog. Now, I’m not too sure which one is better and which is the most popular. Any ideas? Thanks

  • Avatar Roar me R says:

    I would also like it to be user-friendly and able to customise it too.

  • Avatar Phillip123 says:


    I’m running WP over Xampp.
    Till last night everything was working fine, after that whenever i browse i get 404 page not found error, it’s funny ! i can browse admin panel. even other scripts i installed except this one !
    using ‘localhost’, wordpress/index.php didn’t answer.

    Reinstalled xampp (didn’t help).
    Restore backup sql (didn’t work).

    Would u plz tell me what’s going and what should i do?

  • Avatar Matthew says:

    Hi everyone,

    what would happen if changed


    Does anyone know what it is and why it is used?
    Thanks in advance

  • Avatar Alina Elliott says:

    After attempting to upgrade to WordPress 3.3.1 using the automatic upgrade, and then receiving an error message, I tried to fix it via ftp. I’ve replaced all of wp-admin and wp-includes, as well as the individual loose files from wp-content and the home directory. Now when I go to my site admin I get the following:

    Warning: require(/home/seekinge/public_html/wp-includes/classes.php) [function.require]: failed to open stream: No such file or directory in /home/seekinge/public_html/wp-settings.php on line 68

    Fatal error: require() [function.require]: Failed opening required ‘/home/seekinge/public_html/wp-includes/classes.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/seekinge/public_html/wp-settings.php on line 68

  • Avatar JimT says:

    Well, I think something may have happened in the FTP, I use cPanel (HostGator). So when i type my website URL:, the site dones’t come up, it is all gebrish….

    When I try a backup, I get this:

    This script must be placed at the root of a valid WordPress installation. Please install WordPress via cPanel –> Fantastico and then run this script again.

    What should I do? Thanks!
    tthe ‘Script’ would be the backup

Leave a Reply

%d bloggers like this: