How to measure rate of new lines in file (log file)
FILE=/var/log/syslog
DELAY=10
BEFORE=$(wc -l ${FILE}|cut -f1 -d' ')
sleep ${DELAY}
AFTER=$(wc -l ${FILE}|cut -f1 -d' ')
echo $(($AFTER - $BEFORE))
Gives you a count of number of lines added in 10s.
cat /var/log/myfile | while (( ( (index++) % 5 ) == 0 )) { sms/chat-session/whatever }
update: actual general working code:
dmesg | while true; do <br>
if [ $(( $(( index++ )) % 5 )) -eq 0 ]; then
nc -p srcport --send-only hostname port or arduino ...:P
sms/write/chat-session/whatever;
fi
done
snmp might be a more useful idea under certain circumstances.