Loaded Commerce Community

Banner


Board index » CRE Loaded Support » CRE Loaded 6.3

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Cron sql dump to backup database?
PostPosted: Sun May 15, 2011 8:40 pm 
Offline
CRE Talented

Joined: Thu Dec 25, 2008 5:09 pm
Posts: 489
Location: CO
Could someone tell me if this would work to set up a cron job and backup the database?
$datestamp = date("Y-m-d");
$filename = DIR_FS_CATALOG . "admin/backups/$datestamp.sql.gz";
mysqldump -u dbuser --password=pwd dbname | gzip > $filename


Of course I would add in the other necessary calls to the config files but mainly I am looking to know if my method would capture everything in the database so if I needed to I could do a restore the file would be valid.

Thanks!

Mike


Top
 Profile  
 
 Post subject: Re: Cron sql dump to backup database?
PostPosted: Mon May 16, 2011 8:03 am 
Offline
CRE Legend
User avatar

Joined: Thu Jun 12, 2008 6:39 am
Posts: 2405
Location: New Zealand
As it is, not a chance, but if you have access to cron then wouldn't it be easier to make the cron command execute say /admin/backup.php?action=backup on a schedule? Cronjob configurations can depend on who you're hosted with, but if you have shell access then you can test different commands before adding it to the cronjob.

Simon

_________________
www.codemehappy.com
For Cre Loaded tips, how-to articles and more


Top
 Profile  
 
 Post subject: Re: Cron sql dump to backup database?
PostPosted: Mon May 16, 2011 5:20 pm 
Offline
CRE Talented

Joined: Thu Dec 25, 2008 5:09 pm
Posts: 489
Location: CO
I was mainly looking at this line as the one in question:
mysqldump -u dbuser --password=pwd dbname | gzip > $filename

Now I could do as you suggested, which is a good suggestion, but I was going to build this into a php file that would do an "off site" ftp so the back-ups would not be only on my server. I just didn't want to cloud the water with too much detail (which I fear I might have).

Thanks!

Mike


Top
 Profile  
 
 Post subject: Re: Cron sql dump to backup database?
PostPosted: Mon May 16, 2011 6:56 pm 
Offline
CRE Legend
User avatar

Joined: Thu Jun 12, 2008 6:39 am
Posts: 2405
Location: New Zealand
Yeah but $filename in the line above will break (can't use a string in a path like that) and why write a separate script that connects to the dbase when a couple exist already in /admin that do this? Sounds and looks like hard work.

Offsite backups? - easier / more convenient / cheaper to use 3rd party setup ... google and sift the multitude of choices, many with dozen of options and nice interfaces.

Simon

_________________
www.codemehappy.com
For Cre Loaded tips, how-to articles and more


Top
 Profile  
 
 Post subject: Re: Cron sql dump to backup database?
PostPosted: Mon May 16, 2011 8:09 pm 
Offline
CRE Talented

Joined: Thu Dec 25, 2008 5:09 pm
Posts: 489
Location: CO
Trying your suggestion of "/admin/backup.php?action=backup" didn't work with the cron command. I suspect that it is missing a field since if I manually enter that into the URL it asks what compression I want to use...

I wrote the script I was thinking about, it executed, and it saved the file. Then to look into other options and follow your advice about a google search, I search and I run into this:
http://addons.oscommerce.com/info/3100

Looks almost exactly like what I was recreating. lol.

So it looks like I am going to look at that contrib a little harder to see if it works for CRELoaded (don't see why it wouldn't - it does a sql dump like I was thinking about).

Mike


Top
 Profile  
 
 Post subject: Re: Cron sql dump to backup database?
PostPosted: Mon May 16, 2011 8:14 pm 
Offline
CRE Legend
User avatar

Joined: Thu Jun 12, 2008 6:39 am
Posts: 2405
Location: New Zealand
Yep good move ... use what's out there. Takes too long reinventing the wheel.

Simon

_________________
www.codemehappy.com
For Cre Loaded tips, how-to articles and more


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

Board index » CRE Loaded Support » CRE Loaded 6.3

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
It is currently Thu May 24, 2012 1:16 pm
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Login

Forums Latest Activity

Top Listing

1. Cart2Cart - Shopping...
    Category: Shopping Cart Database Conversion Scripts
    
2. Points & Rewards PLUS!...
    Category: Add-Ons
    
3. Configuration Server...
    Category: Fixes
    
4. Credit Card with CCV
    Category: Payment Modules
    
5. CC7333_ATS
    Category: Templates
    
Show more...

© CRE Loaded is a product of Chain Reaction Ecommerce, Inc. Usage & Privacy Policy