--------------------------------------------
def db_backup():
import os, time
# Change db_list contents to reflect the names of your databases.
db_list = ['computers', 'computers_old', 'techsupport', 'recruits']
for db in db_list:
# For security reasons the user who is doing the dump should not be root. The dump user only needs
# 'select' and 'lock' permissions, nothing else.
backup = os.popen("/usr/bin/mysqldump -user -passwd --opt %s > /path/to/backup/directory/%s.sql" % (db,db))
backup.read()
backup.close()
os.chdir('/path/to/backup/directory/')
real_time = time.strftime("%a-%b-%d-%Y", time.localtime())
tar_it = os.popen("/bin/tar cvzf mysql_DBs.tar.gz-%s *.sql" %real_time)
tar_it.read()
tar_it.close()
db_backup()
---------------------------------------------
adam wrote:
Hello.
I am using mysql 4.0.18 on rh3, and I would like to daily save db state. I
have this small script
under the cron directory that when executed from the prompt works fine.
Basically the dump is done by:
mysqldump --user=root --password=<root-password> --opt bugs > $BACKUPDIR$BACKUPSQLFILE
My problem is that it does not seem to work when the crond calls the script. The result of the dump is a zero size sql file.
I know this might be a Linux problem,but nevertheless what might be the cause?
Regards, Alex
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]