I want to start a certain script every time a certain message appears in var/log/messages
. Is there a more elegant way to do this than with tail -f
Maybe a prog that monitors the kernel messages and can start/stop other programs or scripts?
I would like to do this for reconfiguring my firewall. I use CIPE to establish a VPN with a friend of mine. Since we both have dyn IPs I can only open the CIPE port for all source IPs before the connection is established (since I donīt know his IP before, because I canīt be sure that his dyndns.org account has been already updated).
I want to close this port for all source IPs except his after the connection is established (being a little paranoid
... but it would help to get rid of a lot of ugly messages too).
My idea is: when the connection is established the message "new peer" appears in /var/log/messages, when the connection goes down, I get a "peer down". These messages should trigger a script that changes my iptables rules to fit the situation. Any other suggestions are of course welcome.
THX for any tips in advance