Jeff,

Here is a piece of my backup script.  Its been modified from Unix world to
windoze world ( because at this point I
am working in that environment - seeking to return to Unix if anyone has a
gig )


=pod
=head1   Script:  mysql_backup.pl
=head2
=over 4
=item 1
This script builds a db dump file to s:\mysql_dump 
The dump file is named for the date

In addition this script backs up all script files in cgi-bin to s drive for
nightly backup

=back
=cut



use HTTP::Date;

my ($time, $date_string, $cmd, $s);

$date_string = time2str($time);    # Format as GMT ASCII time
$date_string =~ s/\s/\_/g;
$date_string =~ s/[^a-zA-Z0-9]//g;

$cmd = &build_cmd('my_mysqldb');

&do_cmd($cmd);


exit(0);

sub build_cmd{
        my ($name) = @_;
        my $s = $date_string . $name . '.dmp';
        my $cmd = qq!mysqldump -c --add-drop-table -uroot -psirron $name >
s:\\mysql_backup\\!;
        $cmd .= $s;
        return($cmd);
}


sub do_cmd{
        my ($cmd) = @_;
        if (!(system ("$cmd") == 0)){
                warn "could not do system  $cmd - $!";
        }
}

-----Original Message-----
From: Jeff Snoxell [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 19, 2002 8:16 AM
To: [EMAIL PROTECTED]
Subject: Programmatic MySQL backup in Perl


Hi,

is there an easy way to programmatically backup MySQL database tables using 
Perl? My Perl code will be running on a machine remote to the MySQL server.

Ta,

Jeff


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