News:

Click here for Toll-Free Service for your business starting at $2.00 per month

Main Menu

backing up database and files using a cron job

Started by MaestroC, January 07, 2006, 07:30:28 PM

Previous topic - Next topic

MaestroC

When the old freepgs server burned up my site went with it  because I never bothered to backup the database.  I had copies of the site files, but they were no good without the database to go with them.  Now that my site is recreated and better than ever I want to make sure I never have this happen again, but backing up the DB via the phpmyadmin panel is tedious and I would prefer to be able to do an automatic backup at a regular interval.

Since I am hosted on the plesk server, is there a cron job that I could run to automatically backup my database and email it to me at my gmail account at a regular interval of say, every Sunday and Wednesday night?  If there is, what would be the command to put into the crobtab?  I tried doing it myself using suggestions from other web sites but it never seems to work.

The main issue for me is the database, but is there also a way to backup my entire directory, compress it, and email it as well?

Sincerely,
MaestroC
www.musicedmagic.com

sixthcrusifix

Don't you use PHPMyADMIN? Can't you just export it every once and a while? That's what I do, but I'm not using Plesk.
Visite me website at http://www.sixthcrusifix.com

MaestroC

I do use phpmyadmin, but only when I remember to do it.  That is why I lost my entire site when the fire hit I hadn't made a backup in several weeks.  To combat my absentmindedness I want it to be automatic and simple.

sixthcrusifix

#3
Put this in your main page, or admin CP or somewhere you'll see it.

<?php
$date_ 
date("D");
if(
$date_=="Sun"){
echo(
"<script>alert(\"IT'S SUNDAY! BACKUP YOUR SITE!\")</script> ");
}
?>

Visite me website at http://www.sixthcrusifix.com

MaestroC

Thanks for the suggestion, but I know there has got to be a way to do it automatically.  Even if it is just a simple php script that I can have cron call to execute on a regular basis.

sixthcrusifix

Quote from: MaestroC on January 08, 2006, 03:40:26 AM
Thanks for the suggestion, but I know there has got to be a way to do it automatically.  Even if it is just a simple php script that I can have cron call to execute on a regular basis.

yeah but I cron job cant make it download to your comnputer, you could easily have the files zipped and stored on your site every sunday but you'd have to remember to download them.

Having them emailed to you us a possibilty though, I can think of a script that uploads a file and emails it in PHP, I bet you could hav ethat done every sunday, try the contact form.
Visite me website at http://www.sixthcrusifix.com