Skip to content

Instantly share code, notes, and snippets.

@sh2
Created February 13, 2014 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sh2/8973934 to your computer and use it in GitHub Desktop.
Save sh2/8973934 to your computer and use it in GitHub Desktop.
List start time of MySQL binary logs
#!/bin/bash
for BINLOG in $@; do
echo $BINLOG $(mysqlbinlog $BINLOG 2>/dev/null | awk '/^#[0-9]/ { print $1, $2 }' | head -1)
done
==
$ ./list.sh mysql/binlog/*
mysql/binlog/mysql-binlog.000001 #140206 18:14:57
mysql/binlog/mysql-binlog.000002 #140207 11:13:14
mysql/binlog/mysql-binlog.000003 #140207 13:04:08
mysql/binlog/mysql-binlog.000004 #140207 17:20:55
mysql/binlog/mysql-binlog.000005 #140213 20:19:57
mysql/binlog/mysql-binlog.index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment