<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 7/02/2011, at 2:33 AM, kellyremo wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br><span style="font-family: Verdana,Arial,Helvetica,sans-serif;">I have 2 script. Script "A", Script "B".<br><br>Script "A" is regulary watching the "dhcpacks" [dhcp release is configured to 2mins] in the logs, for the past 2 minutes. it writes the MAC addresses to a file [/dev/shm/dhcpacks-in-last-2min.txt] every 2 minutes. Ok, this is working, active clients are in this file. Super!<br></span></div></blockquote><div><br></div><div>"The past 2 minutes" is not a good indication of "active client" (unless that's your maximum lease time). It would be better to look in the dhcp.leases file somewhere under /var. There are at least Perl libraries (and very likely Python libraries too) for parsing this file easily.</div><div><br></div><blockquote type="cite"><div><span style="font-family: Verdana,Arial,Helvetica,sans-serif;"><br>Script "B": <a href="http://pastebin.com/raw.php?i=wvhwhPWu" target="_blank">http://pastebin.com/raw.php?i=wvhwhPWu</a><br>I'm trying to create a script, that watches the changes in "/dev/shm/dhcpacks-in-last-2min.txt" file [in every 1 sec]. </span></div></blockquote><div><br></div><div>Why on earth are you putting it under /dev/shm/?</div><div><br></div><div>Surely /tmp, /var/tmp, or /var/lib/FOO would be better.</div><br><blockquote type="cite"><div><span style="font-family: Verdana,Arial,Helvetica,sans-serif;">Ok. But: my "watcher" script [the pastebined] is not working fine...sometime it works, sometime it send that someone "XY logged out", but it's not true! nothing happened, and the problem is not in the Script "A".<br></span></div></blockquote><div><br></div><div>I think your log-out detection is faulty. The only way you could reasonably infer this is if either a DHCP RELEASE message has been received, or the lease has not been renewed after the lease-expiry.</div><div><br></div><div>What is your lease-time?</div><br><blockquote type="cite"><div><span style="font-family: Verdana,Arial,Helvetica,sans-serif;">Can someone help me point out, what am i missing? How can i watch a file [in every sec], that contains only MAC addresses, and if someone doesn't get dhcpack in 2 minutes, the file "/dev/shm/dhcpacks-in-last-2min.txt" changes, and that clients MAC address will be gone from it, and i need to know, who was it [pastebined my script..but somethings wrong with it].<br></span></div></blockquote><div><br></div><div>I would suggest a solution based around dhcp.leases and something like gamin</div></div><br><div>Hope it helps,</div><div>Cameron</div><div><br></div></body></html>