From owner-freebsd-questions@FreeBSD.ORG Sun Feb 6 13:33:33 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BDC61065670 for ; Sun, 6 Feb 2011 13:33:33 +0000 (UTC) (envelope-from kellyremo@zoho.com) Received: from sender1.zohomail.com (sender1.zohomail.com [72.5.230.95]) by mx1.freebsd.org (Postfix) with ESMTP id 53F2F8FC12 for ; Sun, 6 Feb 2011 13:33:33 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=date:from:to:message-id:subject:mime-version:content-type:user-agent; b=ghfyXAd9Zq5dDvkPVGOmtvw2c3tTNI6UiEgWQEsTk0iBLoNykVXWIVwhYZ4Dxi6oA7G2otZK3WVx 4l8GRlGnfDAFwcazSlWiEh3LiB8iepjidY5WWLjFJlk3Py8+WLZN Received: from 172.29.243.251 (172.29.243.251 [172.29.243.251]) by mx.zohomail.com with SMTP id 1296999212802914.146108165081; Sun, 6 Feb 2011 05:33:32 -0800 (PST) Date: Sun, 06 Feb 2011 05:33:32 -0800 From: kellyremo To: "FreeBSD" Message-ID: <12dfb2d663e.8735497800158401667.-7202521450009428314@zoho.com> MIME-Version: 1.0 X-Priority: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail Status: RO Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: if the file changes send email about diff X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Feb 2011 13:33:33 -0000 I have 2 script. Script "A", Script "B". 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! Script "B": http://pastebin.com/raw.php?i=wvhwhPWu I'm trying to create a script, that watches the changes in "/dev/shm/dhcpacks-in-last-2min.txt" file [in every 1 sec]. 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". 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]. Thank you for any help..i've been pathing my script for days now.. :\