Backup using PHP and Cron...

doceave

Joined: 2009-01-20
Posts: 176
Posted: Sat, 2009-12-19 22:01

Hi Guys... I've tried and failed... Any help would be appreciated:

I have found and tried a number of PHP scripts that claim to be able to create zip archives of one's site for storage on local server... quick Google search will reveal numerous such scripts ~ I tried them all.

Can anyone recommend a method by which one can copy a very very large directory on a web server. cPanel provided by my host, BlueHost.com, just stops copying after a time, and FTP does not allow copying back onto local server... (I believe this is to prevent creation of large redundancy with ease)

Basically, a reliable PHP script which can be called every so often to make a simple copy of my G3 folder would be awesome! No compression even necessary... Perhaps just renaming of the copied folder with the date of backup, and deletion of folders older than 1 month maybe...

Thanks in anticipation

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Sat, 2009-12-19 23:08

You're most likely running into memory limits and I've yet to have success with creating large zip files on Linux. Log into your shell account (I'm pretty sure bluehost provides ssh access) navigate to your gallery3 install and type this command (changing what ever you need to get the right directory):

tar -czvf g3var_backup.tgz var/

That will backup the entire var directory.

BTW, your host won't like you having all those extra files around. Don't do that, it's not fair to the host and it's not fair to those you share resources with. Lots of files impact performance and if the server crashes and there's a disk error it takes longer to recover, not only impacting you, but the other 2000+ sites on your shared server.

Having a copy on the same server is not a proper backup solution. That only helps with accidental deletion, modification or file corruption. If the server dies, your files are gone. You should backup and keep a copy on your computer.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
doceave

Joined: 2009-01-20
Posts: 176
Posted: Sun, 2009-12-20 13:29

Many thanks nivekiam... Can you suggest a command that performs a copy rather than compressed archive creation...?

 
doceave

Joined: 2009-01-20
Posts: 176
Posted: Sun, 2009-12-20 13:45

something like cp -R /home2/public_html/gallery /home2/public_html/backups/gallery-20091220

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Sun, 2009-12-20 18:17

Yep, you got it.

At least I'm pretty sure without testing.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here