What's new

Connect/Disconnect trigger

rathmannm

New Around Here
Hi,

I need to detect when a device connects and disconnects from my local network.
I found a script which does exactly that and it works for the connect part:

Create /jffs/configs/dnsmasq.conf.add file with this line :
dhcp-script=/jffs/a/post-lease.sh

Create the /jffs/a/post-lease.sh with the below lines, and set the permissions to executable (chmod):
#!/bin/sh
NowLeasedMac=$2
if [ “$NowLeasedMac” == “11:22:33:44:55:66” ]; then
#Do what you want here when device connects
#e.g. I switch on-off my squeezebox player.
#wget http://192.168.100.50/cgi-bin/Squeezebox/SwitchOnOff.cmd
echo “Caught !”
fi
#

How can I send a trigger in the event a device drops off the network/disconnects??

Cheers,
Manuel
 
How can I send a trigger in the event a device drops off the network/disconnects??

You can't, since there's no "mechanism" for a client to notify that it's about to disconnect. The only way would be to constantly poll the list of connected and active clients to see if any has dropped.
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top