Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Cron job to back up your db every night

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 11-11-2002, 02:36 PM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default Cron job to back up your db every night

This was posted by rbarclay and may be of use to you all

Quote:
Try this. It is a shell script that will make a compressed dated backup of your whole database (xcart plus whatever other stuff you have in there)

Replace USERNAME and PASSWORD with your info. I have put spaces between each line because I am not sure if with the wrapping it will be easy to follow otherwise. Also you will have to change the paths. my file is called datacollectionbackup.sh. Remember to run "chmod u+x datacollectionbackup.sh" after you create the file to make it executable.

BEGIN SCRIPT FILE

DATE=`date +"%Y-%m-%d-%H%M%S"`

/usr/local/mysql/bin/mysqldump --all-databases --add-drop-table -c -f -F -a -q -u USERNAME --password="PASSWORD" > /usr/backups/mysqldump/data-collection-${DATE}.sql

gzip /usr/backups/mysqldump/data-collection-${DATE}.sql

END SCRIPT FILE

My crontab entry is:

30 01 * * * /root/datacollectionbackup.sh


This runs it at 130 every morning.

good luck
ross
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #2  
Old 03-17-2003, 07:45 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Just thought I would highlight this for all the newbies out there - this works a treat and you SHOULD ALWAYS have a backup in place for your database - They can and DO crash.
__________________
ex x-cart guru
Reply With Quote
  #3  
Old 12-06-2003, 01:46 PM
 
mnrrcom mnrrcom is offline
 

Advanced Member
  
Join Date: Apr 2003
Posts: 41
 

Default

Good stuff! can someone walk through the cron script to explain what each line does.
__________________
X-CART v3.4.7 GOLD
Reply With Quote
  #4  
Old 12-09-2003, 11:30 AM
  leon's Avatar 
leon leon is offline
 

X-Wizard
  
Join Date: Mar 2003
Location: Costa Rica
Posts: 1,213
 

Default

I think I already posted this, but here is a great tutorial:

http://www.phpfreaks.com/tutorials/28/0.php

On the other hand if you really want to automate backups, use a Tool called "DARKMANS SITE BACKUP TOOL" it is really the BEST I have used and it not only backs up your Database, it works for specific directories as well, and it backs up everything to a folder on your server and it can even send it via email, after compresion if you like.

FIVE STAR RECOMMEND

Here is the link:

http://www.crohack-forum.com/forum/viewforum.php?f=18

It will make your life alot easier.
__________________
It doesn\'t matter what is done... it is how it is done.
=============================
XCart Version: 3.5.3 -> Dmcigars.com
XCart Version: 4.1.3....
Reply With Quote
  #5  
Old 12-14-2003, 03:35 PM
 
mnrrcom mnrrcom is offline
 

Advanced Member
  
Join Date: Apr 2003
Posts: 41
 

Default Seurity Issue?

Being that the username and password is in the file, how do you keep it secure on a shared web hosted machine?
__________________
X-CART v3.4.7 GOLD
Reply With Quote
  #6  
Old 12-14-2003, 09:15 PM
  leon's Avatar 
leon leon is offline
 

X-Wizard
  
Join Date: Mar 2003
Location: Costa Rica
Posts: 1,213
 

Default

If you are talking about the site backup tool, remember that the password is encrypted from the xcart software, so even if anybody catches it, they wont be able to access it.

On the other hand, you could hide the backups in a protected directory, really internal so nobody can notice it.

Or send only by email without keeping file on server.
__________________
It doesn\'t matter what is done... it is how it is done.
=============================
XCart Version: 3.5.3 -> Dmcigars.com
XCart Version: 4.1.3....
Reply With Quote
  #7  
Old 12-14-2003, 10:33 PM
 
rrf rrf is offline
 

X-Cart team
  
Join Date: Sep 2002
Posts: 543
 

Default

Quote:
Originally Posted by leon
If you are talking about the site backup tool, remember that the password is encrypted from the xcart software, so even if anybody catches it, they wont be able to access it.

... unless they have access to the decryption code (i.e. the X-Cart code).
__________________
Sincerely yours,
Ruslan R. Fazliev,
CEO

Twitter: @aznakai
Reply With Quote
  #8  
Old 12-14-2003, 10:42 PM
  leon's Avatar 
leon leon is offline
 

X-Wizard
  
Join Date: Mar 2003
Location: Costa Rica
Posts: 1,213
 

Default

Ooops, you are right about that. So I guess that only the other options could be considered for better protection, anyway there is no 100% security, the only way to avoid at the Max in a backup from a shared account would be executing a manual download of the backup.

And even though, if its shared, there might be someone able to access the MySql server also.
__________________
It doesn\'t matter what is done... it is how it is done.
=============================
XCart Version: 3.5.3 -> Dmcigars.com
XCart Version: 4.1.3....
Reply With Quote
  #9  
Old 12-15-2003, 03:19 PM
 
mnrrcom mnrrcom is offline
 

Advanced Member
  
Join Date: Apr 2003
Posts: 41
 

Default Re: Seurity Issue?

Quote:
Originally Posted by mnrrcom
Being that the username and password is in the file, how do you keep it secure on a shared web hosted machine?

To clarify I mean the password is stored in the shell program file from the code example above posted by rbarclay.
__________________
X-CART v3.4.7 GOLD
Reply With Quote
  #10  
Old 12-15-2003, 06:08 PM
  leon's Avatar 
leon leon is offline
 

X-Wizard
  
Join Date: Mar 2003
Location: Costa Rica
Posts: 1,213
 

Default

mmmm, ahhhh, mmmm who is rbarclay?
__________________
It doesn\'t matter what is done... it is how it is done.
=============================
XCart Version: 3.5.3 -> Dmcigars.com
XCart Version: 4.1.3....
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:57 AM.

   

 
X-Cart forums © 2001-2020