Re: Patch for review: "Handle InnoDB tables in copy-backup.py"
- From: Olav Vitters <olav bkor dhs org>
- To: Owen Taylor <otaylor redhat com>
- Cc: gnome-infrastructure gnome org
- Subject: Re: Patch for review: "Handle InnoDB tables in copy-backup.py"
- Date: Sun, 9 Aug 2009 21:12:41 +0200
On Sun, Aug 09, 2009 at 02:59:11PM -0400, Owen Taylor wrote:
> # Backup!
> +def shell_quote(s):
> + return "'" + s.replace("'", "'\\''") + "'"
Insure! Not acceptable for a script run by root, even if impact is
minimal.
> for db in dbs:
> - os.spawnlp(os.P_WAIT, 'mysqlhotcopy', 'mysqlhotcopy', '--quiet', '--allowold', db, '/var/lib/mysql-backup')
Better to use subprocess.
> + table_status = os.popen("mysql --batch -e 'show table status' %s" % shell_quote(db), 'r')
Better to use subprocess
> + os.spawnlp(os.P_WAIT, 'mysqlhotcopy', 'mysqlhotcopy', '--quiet', '--allowold', db, '/var/lib/mysql-backup')
Better to use subprocess
> + os.spawnlp(os.P_WAIT, 'sh', 'sh', '-c',
> + "mysqldump --single-transaction %s | gzip -c > %s" % (shell_quote(db), shell_quote(outfile)))
Use subprocess. You can pipe things together.
--
Regards,
Olav
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]