tail a constantly updated logfile and perform an action when a string is found

Viewed 153

I have an odroid-c1+ that I would like to use as a pi-hole server (basically dns blackhole for ad's)

I would like to trigger an led to blink when a string is found in the logfile.

I also have wiringpi installed and working, the example blink.sh works as expected as follows:

PIN=0

gpio mode $PIN out

while true; do
  gpio write $PIN 1
  sleep 0.5
  gpio write $PIN 0
  sleep 0.5
done

How would one go about adding the tailf trigger to this sample?

2 Answers
Related