Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> Raven's RavenNuke(tm) v2.02.02 Distro
Author Message
giantmidget
Regular
Regular


Joined: Nov 27, 2005
Posts: 53

PostPosted: Mon Nov 06, 2006 6:32 pm Reply with quote

Would it be possible to incorporate automatic database backups into Raven Nuke - configurable by the user for times, and just saved on the site somewhere in a backup folder ?

Saw someone attempt this before through Cron Jobs, but I do not remember the info. Would be easier through a nuke interface.
 
View user's profile Send private message
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9449
Location: Arizona

PostPosted: Mon Nov 06, 2006 6:38 pm Reply with quote

This has not been discussed internally, however, you may want to check out this:
Only registered users can see links on this board! Get registered or login!

I have used his auto backup before in combination with my Windows built-in scheduler to kick off the backup on whatever schedule I choose.

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
loraxx
Regular
Regular


Joined: Jan 24, 2008
Posts: 58

PostPosted: Fri Feb 29, 2008 7:20 pm Reply with quote

I tool would love to have a built in backup system. I will check out your link montego.
 
View user's profile Send private message
loraxx
PostPosted: Fri Feb 29, 2008 7:58 pm Reply with quote

loraxx wrote:
I tool would love to have a built in backup system. I will check out your link montego.


Ok program installed and ran well. I got my back in an email but it did not import. I recieved the following errror. Did you resolve this montego?

Image
 
montego
PostPosted: Sat Mar 01, 2008 7:32 am Reply with quote

loraxx, I have never installed it as I am using my control panel backup tool provided by my host. Most, if not all?, hosting control panels have a backup option and you can even use an FTP client on your PC to automatically pull it down. I just have no need for a PHP-based solution.
 
loraxx
PostPosted: Sat Mar 01, 2008 11:06 am Reply with quote

My control panel allows me to make backup and FTP is also an option. However, I was looking for something that would make backups while I'm out of town or start to get lazy. It gives me a warm fuzzy to know that my sites database is backuped daily and a copy is at a third location decoupled from my web hosting company,
 
Gremmie
Former Moderator in Good Standing


Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA

PostPosted: Sat Mar 01, 2008 2:53 pm Reply with quote

Does your control panel let you do cron jobs?

_________________
Only registered users can see links on this board! Get registered or login! - An Event Calendar for PHP-Nuke
Only registered users can see links on this board! Get registered or login! - A Google Maps Nuke Module 
View user's profile Send private message
loraxx
PostPosted: Sat Mar 01, 2008 4:34 pm Reply with quote

Why yes it does standard and advance. I did not know it did. Remember this in only my first month doing the website thing, so sorry for being such a noob. I'm trying to learn fast.
 
Gremmie
PostPosted: Sat Mar 01, 2008 4:43 pm Reply with quote

No problem!!! Perhaps you can use cron to schedule backups somehow. That's how I do it, but I have root access to my box.
 
loraxx
PostPosted: Sat Mar 01, 2008 4:46 pm Reply with quote

Thanks I will check it out. Another jounrney for the noob Smile

If you have time please look at my post below:
Only registered users can see links on this board! Get registered or login!
 
loraxx
PostPosted: Sun Mar 02, 2008 12:06 am Reply with quote

Gremmie that cron suggestion was excellent. The power of the cron line command is incredible. The capability exceeds advance nuke backup. So if the web hosting site gives you access to cron no need for advance nuke backup. IM SO HAPPY Very Happy Very Happy Very Happy Very Happy

Thanks !!!

BTW 100% success at making scheduled backups and backups import with 0% loss. Perfect match !!!

Next I will add emailing my zipped backup.
 
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 17077

PostPosted: Sun Mar 02, 2008 9:46 am Reply with quote

loraxx,

If you would be so kind as to share your cron code/script I will make it a sticky for other users to use. Thanks!
 
View user's profile Send private message
loraxx
PostPosted: Sun Mar 02, 2008 9:55 am Reply with quote

Raven,

No problem.

I have not figured out the cron email file part yet but will when I have some more time I will post that as well.

If your web host control panel allows cron commands you can use the following command to get a backup of you database and place it in a folder on your sever (note I strongly recommend this folder NOT be in websites folder for security reasons).


date=`date -I` ; mysqldump -uusername -ppassword databasename > /yourfolderlocation/maindatabse_$date.sql; gzip /yourfolderlocation/maindatabse_$date.sql

NOTE:
1. no space after -u and -p
2. databasename, username, and password are all the same form as used in config.php
3. your control panel will allow you to schedule when this command is executed with an infinite number of options


BTW this command also gzips the database when done.

As I have time I will refine this command. Next step is to add emailing of gziped file to remote site.
 
Raven
PostPosted: Sun Mar 02, 2008 10:11 am Reply with quote

Thanks!
 
Doulos
Life Cycles Becoming CPU Cycles


Joined: Jun 06, 2005
Posts: 626

PostPosted: Sun Mar 02, 2008 11:27 am Reply with quote

could you say that in Linux-for-dummies language? What do we use for yourfolderlocation?

is this the proper format?

home/username/public_html/mysqlbackupfolder ?????

home/username/folderoutsidepublic/mysqlbackupfolder ???


Edit: I found my answer. Thanks
 
View user's profile Send private message
Gremmie
PostPosted: Sun Mar 02, 2008 12:52 pm Reply with quote

Here is a Perl script I wrote that does basically the same thing. I have cron run this every night. It does multiple databases.

Code:


#!/usr/bin/perl
# mysqlbackup.pl - Gremmie Feb 22, 2008
# For backing up my MySQL databases

@dbs = (
   {
     db => 'dbname1',
     user => 'dbuser1',
     password => 'dbpass1',
   },
   {
     db => 'dbname2',
     user => 'dbuser2',
     password => 'dbpass2',
   },
   {
     db => 'dbname3',
     user => 'dbuser3',
     password => 'dbpass3',
   },
);

chomp($date = `date +%Y%m%d`);

foreach $db (@dbs)
{
   $outFile = '/var/local/backups/' . $db->{'db'} . $date . '.sql';
   $cmd = "mysqldump --user=$db->{'user'} --password=$db->{'password'} $db->{'db'} " .
      " > $outFile";
   # print $cmd . "\n";
   print "Dumping $db->{'db'}...\n";
   `$cmd`;
   print "Compressing $db->{'db'}...\n";
   `bzip2 $outFile`;
}
print "Done.\n";



Just add or remove array elements for each database you have. And tweak the path it is saving to. Hope someone finds that useful.
 
loraxx
PostPosted: Thu Mar 06, 2008 8:55 am Reply with quote

gremmie,

I have been unable to identify a set of commands that will automatically email my backed up files to me. Note, I want to use the cron scheduler not a script since I do not have that capability on my web hosting site.

the mail command drops characters off of binary files I hear, gzip is binary I assume

my host does not support mutt

Any ideas???
 
Gremmie
PostPosted: Thu Mar 06, 2008 10:04 am Reply with quote

I would probably look at it from the PC end. There is probably some ftp software you could get for your PC that you can schedule or script.

You could also run cygwin on your PC. With cygwin you can have cron jobs. If you have ssh access to your server you could schedule a cygwin cron job to scp (secure copy) the backups to your pc.

Those are just off the top of my head...
 
loraxx
PostPosted: Thu Mar 06, 2008 10:15 am Reply with quote

Thanks germmie. I'm not familar with any of that stuff but you have now giving me some direction and things to look into.

BTW, I will be installing your map module sometime today. It will compliment some other stuff we have on our site.
 
Gremmie
PostPosted: Thu Mar 06, 2008 10:45 am Reply with quote

I would imagine there is some fancy FTP software that you could get for the PC that you could schedule transfers for. Your host may also have some kind of automatic backup thing you could use too.

Cool on the member map module! Just make sure you have PHP 5 first.
 
Raven
PostPosted: Thu Mar 06, 2008 11:51 am Reply with quote

loraxx wrote:
the mail command drops characters off of binary files I hear, gzip is binary I assume


Please explain. The mail() function is just an interface to your MTA (Sendmail, Procmail, etc.) so it doesn't drop characters. If something is getting dropped through your MTA then it's because something isn't configured correctly (probably the mime type).
 
danny234
Worker
Worker


Joined: Feb 14, 2008
Posts: 123

PostPosted: Sat Mar 08, 2008 7:39 am Reply with quote

Gremmie wrote:
Here is a Perl script I wrote that does basically the same thing. I have cron run this every night. It does multiple databases.

Code:


#!/usr/bin/perl
# mysqlbackup.pl - Gremmie Feb 22, 2008
# For backing up my MySQL databases

@dbs = (
   {
     db => 'dbname1',
     user => 'dbuser1',
     password => 'dbpass1',
   },
   {
     db => 'dbname2',
     user => 'dbuser2',
     password => 'dbpass2',
   },
   {
     db => 'dbname3',
     user => 'dbuser3',
     password => 'dbpass3',
   },
);

chomp($date = `date +%Y%m%d`);

foreach $db (@dbs)
{
   $outFile = '/var/local/backups/' . $db->{'db'} . $date . '.sql';
   $cmd = "mysqldump --user=$db->{'user'} --password=$db->{'password'} $db->{'db'} " .
      " > $outFile";
   # print $cmd . "\n";
   print "Dumping $db->{'db'}...\n";
   `$cmd`;
   print "Compressing $db->{'db'}...\n";
   `bzip2 $outFile`;
}
print "Done.\n";



Just add or remove array elements for each database you have. And tweak the path it is saving to. Hope someone finds that useful.


Gremmie could you please explain your code, I want to backup my website incase mine goes wrong again then I can just use the backup so in my hosting control panel I goto cron jobs and put your code into the command box? What do I put where you have 'out file=' where do I put the date and time I want to run it?

yes I am a complete noob, please forgive me lol
 
View user's profile Send private message Visit poster's website MSN Messenger
Gremmie
PostPosted: Sat Mar 08, 2008 11:03 am Reply with quote

danny234, my code sort of assumes you have shell access to your server. I have that file, the perl script, stored in a user directory on the server. Cron runs it every night, copying the backups (and compressing them) to yet another directory on the server. Right now I am periodically ftp'ing the latest backups from the server to my home pc. If you don't have shell access I'm not sure you could make that work. In that case just use your control panel your host gave you to do database backups. You may have to use phpMyAdmin to do it.
 
danny234
PostPosted: Sat Mar 08, 2008 11:07 am Reply with quote

So once I have done the backup I get a compressed sql file of the database and this is my whole site backed up? How do I get my website back the way it was from the backup do I just upload the sql compressed file somewhere or do I upload it to my database and my website will be back to the way it was?
 
Raven
PostPosted: Sat Mar 08, 2008 2:48 pm Reply with quote

Excuse the interruption Smile

Danny, doesn't your provide you with nightly backups? If so, then you would just need a cron job that sends you the already backed up file.
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> Raven's RavenNuke(tm) v2.02.02 Distro

View next topic
View previous topic
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 vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©