]>
Commit | Line | Data |
---|---|---|
1cc0573f JP |
1 | #!/usr/bin/python |
2 | ||
3 | import time | |
4 | import MySQLdb as sql | |
5 | con = sql.connect('localhost','root','',unix_socket='/srv/mysql/mysql.sock') | |
6 | cur = con.cursor(sql.cursors.DictCursor) | |
7 | ||
8 | while 1: | |
9 | cur.execute('SHOW SLAVE STATUS') | |
10 | r = cur.fetchone() | |
11 | if r['Slave_IO_Running'] == 'Yes' and r['Seconds_Behind_Master'] is None: | |
12 | print 'Skipping next due to:' | |
13 | print r['Last_Error'] | |
14 | cur.execute('SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1') | |
15 | cur.execute('START SLAVE') | |
16 | else: | |
17 | time.sleep(1) |