Skip to content

Instantly share code, notes, and snippets.

@waj
Created August 13, 2014 16:45
Show Gist options
  • Save waj/8e4a058c65e0e3d31c4e to your computer and use it in GitHub Desktop.
Save waj/8e4a058c65e0e3d31c4e to your computer and use it in GitHub Desktop.
Tail logs in MySQL table
#!/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