You can try something like this:
DateDir=Directory where you want your backups saved
                print $output->printheader;

                my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst )=
localtime(time);
                $year = $year + 1900;
                $mon++;
                my $filename = "DataDir/MySQLBackup$mon-$mday-$year.sql";
                my $c = "";
                my $oldfilename = "$filename.gz$c";
                while (-e $oldfilename) {
                        $c++;
                        $oldfilename = "$filename.gz$c";
                }
                if ($c > 0) {
                        rename("$filename.gz", $oldfilename);
                }
                my $command = undef;
                        $command = "mysqldump -u DatabaseUserName -p DatabasePassWord
DatabaseName>$filename";
                        my $result = `$command`;
                        system("gzip -9 $filename");

                print '<BODY BGCOLOR="#FFCC99" text="black" link="black" 
alink="#C0C0C0"
vlink="black">' . "\n\n";
                print "<CENTER>\n";
                print "<TABLE BGCOLOR=#7373AA BORDER=0 WIDTH=90%><TR 
BGCOLOR=#7373AA><TD
BGCOLOR=#7373AA>\n";
                print "<TABLE BGCOLOR=#7373AA BORDER=0 CELLPADDING=1 CELLSPACING=1
WIDTH=100%>\n";
                print "<TR BGCOLOR=#7373AA><TD BGCOLOR=#7373AA><CENTER><FONT
COLOR=white><B>Backup Performed</B></FONT></CENTER></TD></TR>\n";
                print "<TR BGCOLOR=white>\n";
                print "<TD BGCOLOR=white>\n";
                print "<B>Your data has been backed up and stored in your Data 
directory
($filename.gz).\n";
                print "</TD>\n";
                print "</TR>\n";
                print "</TABLE>\n";
                print "</TD></TR></TABLE>\n";
                $output->done;




-----Original Message-----
From: Eberhard W Lisse [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 03, 2002 3:07 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: backup databases


> From: David McInnis <[EMAIL PROTECTED]>

>> Could you share your script for doing the date thing with the rest of
>> us?  That sounds useful.

Isn't there a perl script around for backuping?

Something like:

mysqldump DB --add-drop-table --opt \
        |gzip > DBdump.`date +%Y-%m-%d`.gz

should even sort right.

el

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to