What you need is a short bash script, like:
#!/bin/sh
while [ 1 ]
do
if [ "PARAMETER" = "SOMETHING" ]; then
notify-send "Attention" "There is a new connection."
else
echo "Nothing Found"
fi
sleep 5
done
Basically, this would listen for a PARAMETER
(How, I don't know...), and when it equals SOMETHING
, then it will send a notification. If the PARAMETER
is not equal to SOMETHING
, it will print Nothing Found
(This is not necessary, it just shows that it is working), wait for 5 seconds, and start again.
The problem is getting it find when it has connected... None of these...
netstat -n -A inet
cat /proc/net/ip_conntrack
- apparently deprecated anyway, see here
ss -n
...seem to produce the parameters required...
Any corrections welcome, especially with the bash script