FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora User

 
 
LinkBack Thread Tools
 
Old 02-06-2011, 12:33 PM
kellyremo
 
Default if the file changes send email about diff

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.. :
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
 
Old 02-06-2011, 12:33 PM
kellyremo
 
Default if the file changes send email about diff

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.. :
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 02-06-2011, 01:33 PM
"Joseph L. Casale"
 
Default if the file changes send email about diff

>I'm trying to create a script, that watches the changes in
> "/dev/shm/dhcpacks-in-last-2min.txt" file [in every 1 sec].

Have look at Gamin, its designed for this type of thing...
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 02-06-2011, 01:40 PM
frank thyes
 
Default if the file changes send email about diff

On Sun, 2011-02-06 at 05:33 -0800, kellyremo wrote:

> /dev/shm/dhcpacks-in-last-2min.txt

Could you pastebin this file too?

Frank


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 1297003232.3224.0.camel@leela">http://lists.debian.org/1297003232.3224.0.camel@leela
 
Old 02-06-2011, 04:25 PM
kellyremo
 
Default if the file changes send email about diff

The file only contains plain MAC addresses, separated with a new line:

Like:
FF:FF:FF:FF:FF:F1
FF:FF:FF:FF:FF:F2

Or:
FF:FF:FF:FF:FF:F2

---- On Sun, 06 Feb 2011 06:40:32 -0800 frank thyes <frank@anotheria.net> wrote ----

On Sun, 2011-02-06 at 05:33 -0800, kellyremo wrote: > /dev/shm/dhcpacks-in-last-2min.txt Could you pastebin this file too? Frank -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: http://lists.debian.org/1297003232.3224.0.camel@leela
 
Old 02-06-2011, 04:27 PM
kellyremo
 
Default if the file changes send email about diff

"Gamin"? can you give a link? Google doesn't bring up relevant links regarding it :O

---- On Sun, 06 Feb 2011 06:33:00 -0800 Joseph L. Casale <jcasale@activenetwerx.com> wrote ----

>I'm trying to create a script, that watches the changes in > "/dev/shm/dhcpacks-in-last-2min.txt" file [in every 1 sec]. Have look at Gamin, its designed for this type of thing... _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos


_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 02-06-2011, 04:38 PM
Michael Klinosky
 
Default if the file changes send email about diff

kellyremo wrote:
> "Gamin"? can you give a link? Google doesn't bring up relevant links
> regarding it :O

http://www.google.com/linux?hl=en&q=gamin&btnG=Search

Note bene ------------^^^^^
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 02-06-2011, 04:42 PM
Eduardo Grosclaude
 
Default if the file changes send email about diff

On Sun, Feb 6, 2011 at 2:38 PM, Michael Klinosky <mpk2@enter.net> wrote:
> kellyremo wrote:
>> "Gamin"? can you give a link? Google doesn't bring up relevant links
>> regarding it :O

"yum search gamin" will surely help.

--
Eduardo Grosclaude
Universidad Nacional del Comahue
Neuquen, Argentina
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 02-06-2011, 05:48 PM
frank thyes
 
Default if the file changes send email about diff

On Sun, 2011-02-06 at 09:25 -0800, kellyremo wrote:
> The file only contains plain MAC addresses, separated with a new line:
>
> Like:
> FF:FF:FF:FF:FF:F1
> FF:FF:FF:FF:FF:F2
>
> Or:
> FF:FF:FF:FF:FF:F2

Then your script is absolutely useless.

Frank


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 1297018136.3224.6.camel@leela">http://lists.debian.org/1297018136.3224.6.camel@leela
 
Old 02-06-2011, 06:41 PM
Cameron Kerr
 
Default if the file changes send email about diff

On 7/02/2011, at 2:33 AM, kellyremo wrote:
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!

"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.

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].
Why on earth are you putting it under /dev/shm/?
Surely /tmp, /var/tmp, or /var/lib/FOO would be better.
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".

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.
What is your lease-time?
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].

I would suggest a solution based around dhcp.leases and something like gamin
Hope it helps,Cameron
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 08:50 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org