Godaddy Backup Blues

Permalink
As anyone on Godaddy shared hosting found out, there isn't a site backup feature except the archive function in the FTP file brownser.
The problem is, the archive function is capped at 20MB...
I've tried the few PHP scripts out there that backup the entire site structure, only to end up with half of my site in an archive. needless to say, I relied on that archive when I moved my site to a new domain on the same host, only to find out I had to rebuild my sites from scratch, for the fourth time.

Godaddy doesn't offer backups, except their daily backups that don't back up everything; hardly anything really.
They do, however, have the Cron Manager, so I made a shell script and added it to a daily cron routine, so no I have daily backups of my C5 installations.
rm $HOME/html/backups/archive/*.tar.gz
rm $HOME/html/backups/tonopaharizona
GETDATE=`date +%m-%d-%y`
mkdir -p $HOME/html/backups
mkdir -p $HOME/html/backups/tonopaharizona
mkdir -p $HOME/html/backups/tonopaharizona/$GETDATE
mkdir -p $HOME/html/backups/archive
cp -r $HOME/html/blocks $HOME/html/backups/tonopaharizona/$GETDATE
cp -r $HOME/html/blog $HOME/html/backups/tonopaharizona/$GETDATE
cp -r $HOME/html/concrete $HOME/html/backups/tonopaharizona/$GETDATE
cp -r $HOME/html/config $HOME/html/backups/tonopaharizona/$GETDATE
cp -r $HOME/html/contact $HOME/html/backups/tonopaharizona/$GETDATE
cp -r $HOME/html/controllers $HOME/html/backups/tonopaharizona/$GETDATE
cp -r $HOME/html/css $HOME/html/backups/tonopaharizona/$GETDATE
cp -r $HOME/html/elements $HOME/html/backups/tonopaharizona/$GETDATE

But, it won't backup the sql database from the C5 backup folder due to read/write permissions unless I manually set permissions before doing the backup which doesn't matter to me since I have another Cron that dumps my database every night to a different folder.

This will probably work on more than just Godaddy, but replace $HOME/html with $HOME/public_html or whatever your host uses.
Replace tonopaharizona with whatever you want and save the code in a txt file and rename to .sh. In your hosting center, click content, cron job manager, and add the .sh file and set a time for it to run.
So far, it hasn't failed.

Also, I have extra folders being backed up; /gallery, /stats, and /contact. You can remove those lines.

azvampyre
 
jasteele12 replied on at Permalink Reply 1 Attachment
jasteele12
Thanks for sharing this - GoDaddy can be a real pain.

In the same spirit I'll share one of my scripts that I think is a little more flexible as far as exceptions, and I believe more future-proof (in that any new directories don't need to be added).

This creates 2 dated zip files, since I like to keep the files/ separate, and does not back up the core (which I normally have symlink-ed anyway).

I use this slightly modified on quite a few different hosting providers, mostly just changing some of the variables at the top. It doesn't delete anything, but that could easily be added - I handle that with a separate cron job.

Here's the code, but I'm also attaching it in case that's easier for some (there is an example tar at the end, but commented out):

#!/bin/sh
#
# Backup a concrete5 site
#  (a zip for files/ and a zip for everything else)
#
# John Steele -http://www.steelesoftconsulting.com/...
#
# Change these 3 to reflect your environment:
HTML="$HOME/public_html"
BACKDIR="$HOME/backup"
NAME=c5_dirname
DATE=`date +%F`      # DATE=`date +%m-%d-%y`
ZIP="$(which zip)"
   # create the main zip archive (with exclusions)
$ZIP -qyr "$BACKDIR/$NAME.$DATE.zip" $HTML \
azvampyre replied on at Permalink Reply
azvampyre
Since numerous people who use C5 aren't completely prevalent to the coding world, I realized that a shell script might still be too complicated for some.
I wrote this application, which creates the Cron script, uploads it to your site, sets all permissions, and locks the backup folder(s), so that all you need to do is set a time for the Cron job to be run.

This is a desktop application, but if anyone likes it, I can turn it into an addon to the admin page that can be run from your site...or not, either way, here it is.

A link to images of the GUI
http://www.left4dead.us

Attached is the application. It installs on Windows (with Java7 installed), and works with Linux hosting.