| View previous topic :: View next topic |
| Author |
Message |
leandro Voice
Joined: 02 Jun 2007 Posts: 13
|
Posted: Sun Aug 12, 2007 7:03 pm Post subject: Exec without ping timeout. |
|
|
So I'm executing pisg with a HUGE logfile, but most of the time it disconnects the eggdrop with ping timeout because it takes like 2 and a half minutes for pisg to analyse it.
Now, is there a way to execute pisg without being disconnected?
Thanks in advance. (if you want, ill post the tcl script) |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Aug 12, 2007 8:13 pm Post subject: |
|
|
There is the option of using the open command with pipes.
Something like this should be a good start:
| Code: | proc readpipe {fid} {
if {![eof $fid]} {
putlog "pisg: [gets $fid]"
} {
close $fid
}
}
set fid [open "|pisg bla ..." "RDWR"]
fconfigure $fid -blocking 1
fileevent $fid readable [list readpipe $fid]
|
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
leandro Voice
Joined: 02 Jun 2007 Posts: 13
|
Posted: Sun Aug 12, 2007 9:06 pm Post subject: |
|
|
and this wont cause a ping timeout? because if I get this right, i open pisg, and read it until its closed, but then, it takes 3 minutes to close because it takes 3 minutes for pisg to analyse the log.
If i'm wrong please tell me so, thanks for the reply btw! |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Aug 12, 2007 9:16 pm Post subject: |
|
|
The trick here is, output is read as it comes available, being triggered by an event-handler, while "exec" will block until the execution is complete (thus causing your bot becoming unresponsive for several minutes and ping timeout). The "open" command will return instantly, providing a file-handle which you can pretty much use just like any other file, except that you're writing to the program's stdin, and reading from it's stdout.
The "fileevent" command is what sets up the event-handler to track the opened pipe for a readable-condition, at which readpipe will be called to look for an eof-condition, and try to read one line. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Sun Aug 12, 2007 9:18 pm Post subject: |
|
|
Simple solution is to not use eggdrop to do something that can be done far better server side. _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Mon Aug 13, 2007 12:20 am Post subject: |
|
|
| I'd make a little shell script to run pisg, and then run that shell script from cron. I posted an example shell script to do just that, in the shell help forum (it also uploads the stats page to an ftp site if you need that as well.) |
|
| Back to top |
|
 |
leandro Voice
Joined: 02 Jun 2007 Posts: 13
|
Posted: Mon Aug 13, 2007 6:40 am Post subject: |
|
|
Thanks all.
I'll first try the open trick to see if it fits my needs. If not, I'll make that cron script.
Thank you very much. |
|
| Back to top |
|
 |
|