OpenWrt Forum Archive

Topic: Get Iptables to trigger a script

The content of this topic has been archived on 28 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello. I will like to create a script that trigger an action every time when a custom log was created by iptables
Exemple:
If i use in iptables
-j LOG --log-prefix="TRIGGER ME NOW !!!
the script will start a process every time a log prefix is created. how can i do that in OpenWRT?

In "/etc/firewall.user" you can put any "iptables" commands you need.

Ok, and after this? how can i make them to trigger different scripts?

Is this an iptables question or an OpenWrt question? If already you know how to create the rules you need, just paste them in the "firewall.user" file; if you need help defining those rules, I would ask the iptables experts.

I know about iptables. My question is how do i make OpenWRT to start/stop process when a certain log prefix is created by the iptables.

Create a script that periodically scans the log for new TRIGGER ME NOW entries?

(Last edited by tunk on 8 Feb 2018, 15:01)

The discussion might have continued from here.