its not pretty and its not Perl, but this is what we use:

#!/bin/sh

cd ../mysql
for d in *
do
mysqldump -u root --password=putyourpasswordhere --add-drop-table -l $d > 
../mysqlback/$d.dmp
done

Script is run from /var/lib/mydump  so ../mysql gets /var/lib/mydump
which under debian is the directory which holds all the mysql data 
directories which gives me the names of the databases.  

On Wed, 31 Jan 2001, Mike Willey wrote:

> Date: Wed, 31 Jan 2001 05:31:30 -0500
> From: Mike Willey <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: Backup?
> 
> 
> While on the subject of backup scripts -
> 
> Someone had asked on a message board for my webhost about
> whether a script existed for backing up a MySQL database,
> and, rotating backups. I couldn't find anything that did
> everything that he asked, so I wrote something myself. It's
> written in Perl and uses mysqldump since the person didn't
> have a shell account, much less root, on the MySQL server.
> 
> It's not the greatest example of Perl programming, and it's
> only written to backup a single database, but hey, I didn't
> spend more than 2 hours on it. I've used it myself on some
> of my databases for the past 5 months with no problems. I
> just never got around to tweaking it... I have to get out
> of the habit of treating these sorts of things as trivial.
> 
> Here is the script -
> 
> http://www.trickortreat.org/mysql_backup.txt
> 
> Basic usage - create a directory for the database backups, edit
> some variables in the script and create a cron job.
> 
> And here is an example of a crontab file for using the script -
> 
> http://www.trickortreat.org/mysql_backup_cron.txt
> 
> 
> Mike Willey
> [EMAIL PROTECTED]
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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
> 

Sincerely,

William Mussatto, Senior Systems Engineer
CyberStrategies, Inc
ph. 909-920-9154 ext. 27


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