File tree 3 files changed +6
-5
lines changed
3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python
2
2
3
+ from __future__ import print_function
3
4
import MySQLdb
4
5
5
6
db = MySQLdb .connect (read_default_file = '~/.my.cnf' )
6
7
cursor = db .cursor ()
7
8
cursor .execute ('SHOW DATABASES' )
8
9
for (database ,) in cursor :
9
- print database
10
+ print ( database , end = ' \0 ' )
Original file line number Diff line number Diff line change @@ -26,12 +26,12 @@ while [ $kstartret -ne 0 ]; do
26
26
# If we get here, we're under both the lock and the k5start
27
27
28
28
# Get a list of all the mysql databases
29
- for db in $( mysqlshow.py ) ; do
29
+ mysqlshow.py | while read -d $' \0 ' db ; do
30
30
# Make sure the database is in the form username+db
31
31
echo " $db " | grep -q ' +'
32
32
[ $? -ne 0 ] && continue
33
33
# Figure out the size
34
- size=$( du -s /srv/data/mysql/db /$( mysqlname " $db " ) | awk ' {print $1}' )
34
+ size=$( du -s ${base} /$( mysqlname " $db " ) | awk ' {print $1}' )
35
35
[ $size -gt $max_size ] && echo " Skipping $db " && continue
36
36
user=" ${db%% +* } "
37
37
sql-backup.py --local -c sql.mit.edu-afs.json --user=" $user " --database=" $db "
Original file line number Diff line number Diff line change @@ -54,8 +54,8 @@ def main():
54
54
(options , args ) = parser .parse_args ()
55
55
56
56
# Uncomment this to make -v actually work
57
- # logger.setLevel(logging.INFO if options.verbose else
58
- # logging.WARNING)
57
+ logger .setLevel (logging .INFO if options .verbose else
58
+ logging .WARNING )
59
59
60
60
logger .debug (options )
61
61
You can’t perform that action at this time.
0 commit comments