I use a shell script and set up a cron job. Here's the shell script (I call
it mydbbak.sh)

#################################################################
#!/bin/sh
#
# Create /dbbakup directory
# $1 = Unix/MySQL Username
# $2 = Unix/MySQL Password

if [ ! -e /dbbakup ]
 then
  mkdir /dbbakup
  chmod 777 /dbbakup -R
fi

mysqldump -u$1 -p$2 -c --add-drop-table --add-locks --flush-logs --databases
database1>/dbbakup/database1.sql
mysqldump -u$1 -p$2 -c --add-drop-table --add-locks --flush-logs --databases
database2>/dbbakup/database2.sql
mysqldump -u$1 -p$2 -c --add-drop-table --add-locks --flush-logs --databases
database3>/dbbakup/database3.sql

#################################################################


And here's the line from the crontab ...

# Make backups of databases at 3am daily
0 3 * * * /usr/local/bin/mydbbak.sh

Gerald Jensen
----- Original Message -----
From: "Ilyas Keser" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 26, 2002 5:26 PM
Subject: backup script


Has anyone a shell script example to backup all mysql databases at 3
o'clock at the night?

Thanks...
ilyas

---------------------------------------------------------------------
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 <mysql-unsubscribe-##L=##[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to