X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Cron job to back up your db every night (https://forum.x-cart.com/showthread.php?t=617)

shan 11-11-2002 02:36 PM

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

funkydunk 03-17-2003 07:45 AM

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.

mnrrcom 12-06-2003 01:46 PM

Good stuff! can someone walk through the cron script to explain what each line does.

leon 12-09-2003 11:30 AM

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.

mnrrcom 12-14-2003 03:35 PM

Seurity Issue?
 
Being that the username and password is in the file, how do you keep it secure on a shared web hosted machine?

leon 12-14-2003 09:15 PM

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.

rrf 12-14-2003 10:33 PM

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).

leon 12-14-2003 10:42 PM

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.

mnrrcom 12-15-2003 03:19 PM

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.

leon 12-15-2003 06:08 PM

mmmm, ahhhh, mmmm #-o who is rbarclay?


All times are GMT -8. The time now is 11:33 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.