Created
August 13, 2014 16:45
-
-
Save waj/8e4a058c65e0e3d31c4e to your computer and use it in GitHub Desktop.
Tail logs in MySQL table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
MYSQL="mysql -u root nuntium -s -N -e" | |
LASTID=`$MYSQL 'SELECT max(id) from logs'` | |
while true; do | |
$MYSQL "SELECT * FROM logs WHERE id > $LASTID" | |
LASTID=`$MYSQL 'SELECT max(id) from logs'` | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment