
admoga82
New User
Jun 3, 2011, 3:50 AM
Post #1 of 4
(1152 views)
|
open a file with "tail"
|
Can't Post
|
|
Hi, I need some help on this, please. I'm trying to write my script to open a chat log file, parse a string and send a message to the user every time he log in chat (jabber, don't know if it has importance). It works only a little after I run it. It parses fine few rows and after that is hanging on something and do nothing anymore... I don't see what is wrong with it... Can you take a look and give me a hint please? Here is: #!/usr/bin/perl use strict; use warnings; open(LOGFILE,"tail -f chat.log |") || die ("Failed!\n"); while(<LOGFILE>) { if (<LOGFILE> =~ m/user_available for /) { my $string = "$'"; $string =~ /^(.*?)\s/; my @value = split(/"/, $1); my $cmd = "echo `/path/to/command/` | sendxmpp -i @value\@domain.com -t --message-type=headline -v"; system "$cmd"; } } close(LOGFILE); Thank you,
|