This is Mysql Master-Slave Replication Script which is checking position of log. you can set as cron and run.
Read this post on shriikant.blogspot.com