Bash - Get the line that doesn't exist yet and do something with it
Quickly keep tabs on a rolling log file and get notified when X happens.
Use tail -F -n 0
(the elusive zero line that does-not-yet-exist!) combined with the ever amazing quick email script from http://caspian.dotconf.net/menu/Software/SendEmail/.
tail -F -n 0 /var/log/messages | while read LOGLINE
do
[[ "${LOGLINE}" == *"whatever"* ]] && sendEmail -t <your_email> -f <from_mail> -u ${LOGLINE} -s <your_smtp> -m $LOGLINE -q;date;echo "Notification Send For "$LOGLINE
done
Written by Lars Van Casteren
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Related Tags
#bash
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#