Post by Brook » Fri Oct 01, 2010 3:48 am

I am sure someone has thought of this before...

Can someone create a module that would automatically backup the OpenCart database at a specified time of day.
Example: automated backup the database at 2:00 AM CST everyday (or backup however many times a day). The key part is that it would be an automated process that would run however many times a day to backup the database.

As a user of this module, all you would do is
1) Login to the admin website
2) Set the time or times for the database backup
3) Specify the folder location for the destination of the database backup file
4) The database would be backed up and saved to a file on the web server in the specified folder

Active Member

Posts

Joined
Wed Feb 24, 2010 12:15 am

Post by JAY6390 » Fri Oct 01, 2010 8:13 am

One key issue with this, to get it to run, you would require the store owner to set up a cron job before doing this, which means you would need them to understand how to edit cron's

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Qphoria » Fri Oct 01, 2010 9:10 am

Well you could have it run daily at some interval just like the autoupdate currency does. Simply put the trigger in the admin page and when ever a page is loaded in the admin, if 24 has gone by, run the backup.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by JAY6390 » Fri Oct 01, 2010 9:12 am

Yeah, but that isn't really automated is it? What if your admin only works mon - fri, and doesn't log in on the weekends, you're going to miss two days of backups...not really ideal. I understand what you mean, but for a proper automated system, crons are the only solution

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Qphoria » Fri Oct 01, 2010 9:42 am

Silence! It is much more likely that you will login to your store more than that. It works fine for the currency thing and its more than you got now and less confusing than cron.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by OC2PS » Fri Oct 01, 2010 9:47 am

Can a cron job be *automatically* be scheduled by the module script itself? vTiger seems to be able to handle crons without needing users to exit the admin panel...

OC2PS
OC 2.3.0.2, vQmod 2.6.2, Journal2 theme
Arcfesték, Csillámtetoválás, Henna
Image
Check out: All my extensions | My FREE extensions


User avatar
Active Member

Posts

Joined
Wed Jul 22, 2009 4:15 am
Location - Hungary

Post by Qphoria » Fri Oct 01, 2010 9:49 am

well this aint vtiger :)
crons only work on linux boxes so its only a partial solution. Not sure how to interface with task scheduler on a windows box.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by OC2PS » Fri Oct 01, 2010 9:52 am

Come to think of it, what about all these "webcalendar" scripts that let you schedule "reminders" from their web interfaces?

OC2PS
OC 2.3.0.2, vQmod 2.6.2, Journal2 theme
Arcfesték, Csillámtetoválás, Henna
Image
Check out: All my extensions | My FREE extensions


User avatar
Active Member

Posts

Joined
Wed Jul 22, 2009 4:15 am
Location - Hungary

Post by JAY6390 » Fri Oct 01, 2010 10:06 am

True, Windows will make it trickier, since you'll need to use the scheduled tasks editor (or task scheduler in windows 7). Getting a module to have access to something that advanced really isn't something I would advise. Pretty sure you would need to have a script running as a particular user with certain rights to the /etc/crontab. This is something that people should be able to do fairly easily with cpanel and maybe plesk (although last time I looked it wasn't that simple), but other than that, I think its going to be more hassle than it's worth

As for the logins being more frequent than what I put, it really depends on the store IMO, not all stores get sales in mass volumes or even every day, and people go on holidays etc, so their admin doesn't get used during these periods. I realise that these aren't things that happen all the time, but they do happen. I'd personally want my backups done at regular intervals rather than the first time I used my admin panel after 24 hours from the previous backup, preferably at a time where users are at their lowest during the day, to risk any issues or db overloading

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Qphoria » Fri Oct 01, 2010 10:07 am

still once a month is better than never

Or put the trigger on the store front. search engine crawls will trigger it

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by JAY6390 » Fri Oct 01, 2010 10:13 am

Well that might be the solution. All that's needed now is a backup script :P

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by Moggin » Sat Oct 02, 2010 12:22 am

Qphoria wrote:Silence! It is much more likely that you will login to your store more than that.
Autocratic or what! :laugh:

I'll add a vote for this idea too. I don't know enough to be let loose with a cron job, but like the idea of a backup triggered by admin or front office event.

Active Member

Posts

Joined
Wed May 05, 2010 4:56 am

Post by OC2PS » Sat Oct 02, 2010 5:49 am

I assume (hope) admin module logins are less frequent than frontend visits. To reduce database queries (shared hosts usually cap them), I would prefer triggering backup based on admin module login....i.e. when I log into admin, the script checks if it has been 24 hrs since last backup, etc

OC2PS
OC 2.3.0.2, vQmod 2.6.2, Journal2 theme
Arcfesték, Csillámtetoválás, Henna
Image
Check out: All my extensions | My FREE extensions


User avatar
Active Member

Posts

Joined
Wed Jul 22, 2009 4:15 am
Location - Hungary

Post by JAY6390 » Sat Oct 02, 2010 6:24 pm

To check the last time the db was backed up could be run from a config setting, which is loaded each and every time a page is loaded anyway, so it wouldn't make a difference whether it was run of the back end and/or front end really

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by hodet » Mon Oct 04, 2010 1:38 am

I use this;
http://www.dagondesign.com/articles/aut ... up-script/

Then I wrote a bash script (called from cron) that also zips my website, encrypts the database output from the script and the website directory tree (with gpg) and emails it at 1:00am each night to an offsite email account.

At the end of the day I have a local copy of last nights backup and an offsite backup. Its actually saved my bacon once.

Newbie

Posts

Joined
Sun Aug 08, 2010 6:36 am

Post by i2Paq » Mon Oct 04, 2010 10:35 pm

When usıng a VPS wıth Plex (or maybe cPanel) there are some tools that wıll let you backup you mySQL automatıcly.
Contact you hoster and ask what they can offer you.

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands
Who is online

Users browsing this forum: No registered users and 7 guests