This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

file monitoring

Old posts that have not been replied to for several years.
Locked
w
woffer

Post by woffer »

i need a help with a script (duh!)
the script is supposed to open 2 files with "tailf -f" or some eggdrop/tcl built-in function, and check each line in a if,
now to the problem, woun't the bot freeze all it's other functions while checking the files?
P
Petersen
Owner
Posts: 685
Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK

Post by Petersen »

it would if you used exec tail -f, exec is a blocking function.
w
woffer

Post by woffer »

any other way then exec? that woun't lock it ? :smile:

<font size=-1>[ This Message was edited by: woffer on 2002-06-11 16:42 ]</font>
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

No.

Eggdrop is not threaded, and thus, it has to block/freeze to perform the action.

It all depends what the script/exec will be doing. As you maybe able to speed things up, without the use of tailf.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

You can do it 2 ways. You can either use a pipe instead of exec (read the 'open' command) and use non-blocking io on the pipe (see 'filevent').

Or you can write the whole thing in Tcl (use the 'file' command to monitor the access time, then just seek to the end and get the new data).
w
woffer

Post by woffer »

Thanks for the help, but i solved it in another weird way :) learned C and coded my own crapy bot (with threads) just for this function :)
Locked