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.

time out exec ? problem

Old posts that have not been replied to for several years.
Locked
M
MasterJM
Halfop
Posts: 56
Joined: Wed Apr 03, 2002 8:00 pm
Location: germany
Contact:

time out exec ? problem

Post by MasterJM »

proc pub:xy {nick uhost hand chan text} {
global update_setting
puthelp "PRIVMSG $chan :[expr {[catch {exec $xy_setting(exec1)} error]?"$xy_setting(exec1) could not be executed ([string totitle $error]).":$xy_setting(msg1)}]"
}

works fine

but if the bot starts a script that runs longer than ~20 sec
it appears an error - and the script dont finish work

scripts that dont take so much time works fine

is there a time out var or so

(the bot starts a bash script that take 20~30 sec to complete)
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

It all depends what error you get.

First off, I can understand wanting to protect what you are doing, but that usualy means we are too out of the picture.

First off.

What error do you get?

Where is the error generated? By Tcl, or the program your are calling?

Depending on the error, it may well be the program you are calling that is at issue.
M
MasterJM
Halfop
Posts: 56
Joined: Wed Apr 03, 2002 8:00 pm
Location: germany
Contact:

Post by MasterJM »

okay okay

i explain it :)


i have done a little tcl script to run "pisg" (the channel stats with perl)
per trigger from pub


the tcl starts a little bash script like:

#!/bin/bash
/home/masterjm/pisg/pisg --configfile=/home/masterjm/pisg/chan.cfg

(works for 3 litte chans)

but if this is a greater chan (great and long log files) the eggdrops says:

<eggdrop> /home/masterjm/pisg/diablo could not be executed (Could not load pisg! reason:

but in bash (ssh) the script "sh diablo" or "./diablo" works

its not a tcl script or bash script or chmod thing
its something like time out for the exec command in the tcl script t thought?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

I just noticed your problem.

It's related to the way the Tcl exec command handles input from aplications.

There are two default channels available for applications to write too. From the console, both are diaplayed to the user.

However, each can be handled seperatly.

One is called STDOUT, the other STDERR.

When the exec command gets input on STDERR, it automaticaly, throws a Tcl error.

This can and does break Tcl scripts, though using catch will prevent the current event loop ending.

This is what is happening here.

Application do not have to send output to STDERR if it's an error, most use it as a information channel, so that STDOUT can be captured to a file, and the STDERR data is still displayed to a user.

This is likely what pisg is doing, sending output to stdout.

The quickest way to fix it, is to use this in place of your bash script.

Code: Select all

#!/usr/bin/tclsh
set fp [open "|/home/masterjm/pisg/pisg --configfile=/home/masterjm/pisg/chan.cfg" r]
while {![eof $fp]} {
  puts stdout [gets $fp]
}
close $fp
[code]

There is no error handling, but it will save any changes to your eggdrop.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Seems we have a lil problem here. The forum forgot to place the *code* :)
Once the game is over, the king and the pawn go back in the same box.
M
MasterJM
Halfop
Posts: 56
Joined: Wed Apr 03, 2002 8:00 pm
Location: germany
Contact:

Post by MasterJM »

[21:49:51] <MasterJM> !stats
[21:50:15] <eggdrop> /home/masterjm/pisg/diablo could not be executed (Pisg v0.47 - perl irc statistics generator

have changed the bash script

Code: Select all

 /home/masterjm/pisg> cat diablo
#!/usr/bin/tclsh
set fp [open "|/home/masterjm/pisg/pisg --configfile=/home/masterjm/pisg/d2de.cfg" r]
while {![eof $fp]} {
puts stdout [gets $fp]
}
close $fp
the pfad seems also to be right

/home/masterjm/pisg> which tclsh
/usr/bin/tclsh


whats wrong ?
:(
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

You need to set execute permissions of the script

chmod u+x file.name
M
MasterJM
Halfop
Posts: 56
Joined: Wed Apr 03, 2002 8:00 pm
Location: germany
Contact:

Post by MasterJM »

ppslim wrote:You need to set execute permissions of the script

chmod u+x file.name
done

but same error
:(
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

I know it's unlikely, are you sure the path to psig is right in the "open" command.
M
MasterJM
Halfop
Posts: 56
Joined: Wed Apr 03, 2002 8:00 pm
Location: germany
Contact:

Post by MasterJM »

yeah must be right

this methode wirks fine with 3 other channels


same script - but only other bash scripts
:(


is there an other way to make the eggdrop run pisg
with a --option ?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

The only other way, is to launch PSIG into the background, and ignore if it completed or not.

Alternativly, using some more advanced function you could do the following.

Create a small Tcl script that does the following,

1: Runs PSIG
2: Manages and saves the status to a file.

Eggdrop will lauch this script to the background.

It will then periodicaly check for the file with the status info, read it aloud to the channel, and then delete the file.
M
MasterJM
Halfop
Posts: 56
Joined: Wed Apr 03, 2002 8:00 pm
Location: germany
Contact:

Post by MasterJM »

ppslim wrote:The only other way, is to launch PSIG into the background, and ignore if it completed or not.

Alternativly, using some more advanced function you could do the following.

Create a small Tcl script that does the following,

1: Runs PSIG
2: Manages and saves the status to a file.

Eggdrop will lauch this script to the background.

It will then periodicaly check for the file with the status info, read it aloud to the channel, and then delete the file.
oh, this is beyond my tcl knowledge.

so i start it per cronjob *g

thx anyway :)
Locked