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.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
tessa1
Halfop
Posts: 49 Joined: Mon Apr 18, 2005 12:51 pm
Location: Germany
Post
by tessa1 » Fri Mar 24, 2006 6:09 pm
Hi,
I need a script that allows to start some applications on my shell, only in channel #opers, with one public command.
The commands for the shell are ./services ./neostats and ./eggdrop
I can't use exec, because the bot is freezing.
Best regards
demond
Revered One
Posts: 3073 Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:
Post
by demond » Tue Mar 28, 2006 1:23 am
tessa1 wrote:
I can't use exec, because the bot is freezing.
Best regards
then use [open "|application"] for non-blocking I/O
search the forums for "tail -f" example on how to do that
connection, sharing, dcc problems? click
<here>
before asking for scripting help, read
<this>
use
tessa1
Halfop
Posts: 49 Joined: Mon Apr 18, 2005 12:51 pm
Location: Germany
Post
by tessa1 » Tue Mar 28, 2006 3:32 pm
demond wrote: tessa1 wrote:
I can't use exec, because the bot is freezing.
Best regards
then use [open "|application"] for non-blocking I/O
search the forums for "tail -f" example on how to do that
Yes...i heard from [open "|tail -f $filepath"]
...but i can't script this request by myself.
Thats the reason, why I am in Script Request and not in Scripting Help
Best regards
tessa1
Halfop
Posts: 49 Joined: Mon Apr 18, 2005 12:51 pm
Location: Germany
Post
by tessa1 » Wed Mar 29, 2006 10:38 am
Ok.. i try to script this:
Code: Select all
bind pub - !sne sne:start
proc sne:start {nick uhost hand chan arg} {
if {([file readable /home/eggdrop/eggdrop]) && ([file readable /home/ircd/services/services]) && ([file readable /home/NeoStats/neostats])} {
set ca [open "|tail -f /home/eggdrop/eggdrop"]
set cb [open "|tail -f /home/ircd/services/services"]
set cc [open "|tail -f /home/NeoStats/neostats"]
fconfigure $ca -blocking 0
fconfigure $cb -blocking 0
fconfigure $cc -blocking 0
fileevent $ca readable {putserv "privmsg $nick :[read $ca]"}
fileevent $cb readable {putserv "privmsg $nick :[read $cb]"}
fileevent $cb readable {putserv "privmsg $nick :[read $cc]"}
close $ca; close $cb; close $cc
}
return 1
}
But don't works!
Can anyone fix that PLEASE?
Best regards
De Kus
Revered One
Posts: 1361 Joined: Sun Dec 15, 2002 11:41 am
Location: Germany
Post
by De Kus » Wed Mar 29, 2006 1:22 pm
because you get the TCL error '$ca, no such variable'. look at your {} braces and think about them.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under
The MIT License
Love hurts, love strengthens...
tessa1
Halfop
Posts: 49 Joined: Mon Apr 18, 2005 12:51 pm
Location: Germany
Post
by tessa1 » Wed Mar 29, 2006 2:08 pm
I don't know, what is wrong with the braces.
De Kus
Revered One
Posts: 1361 Joined: Sun Dec 15, 2002 11:41 am
Location: Germany
Post
by De Kus » Wed Mar 29, 2006 7:58 pm
Sorry, I didn't notice its not called within an proc. But I see another problem. The file sockets are closed before its read from (because of asyncronous connection and fileevent). Try to move the close statements after the putservs with a ; seperatred, so it looks like:
fileevent $ca readable [list putserv "privmsg $nick :\[read $ca\]"; close $ca]
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under
The MIT License
Love hurts, love strengthens...
demond
Revered One
Posts: 3073 Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:
Post
by demond » Wed Mar 29, 2006 11:12 pm
...not to mention you don't need tail -f here - learn the basics of Linux command line first and only then try to script it
connection, sharing, dcc problems? click
<here>
before asking for scripting help, read
<this>
use
tessa1
Halfop
Posts: 49 Joined: Mon Apr 18, 2005 12:51 pm
Location: Germany
Post
by tessa1 » Thu Mar 30, 2006 10:32 am
demond wrote: tessa1 wrote:
I can't use exec, because the bot is freezing.
Best regards
then use [open "|application"] for non-blocking I/O
search the forums for "tail -f" example on how to do that
hmmm....
tessa1
Halfop
Posts: 49 Joined: Mon Apr 18, 2005 12:51 pm
Location: Germany
Post
by tessa1 » Thu Mar 30, 2006 10:46 am
I hope, this is right now
Code: Select all
bind pub - !sne sne:start
proc sne:start {nick uhost hand chan arg} {
if {([file readable /home/eggdrop/eggdrop]) && ([file readable /home/ircd/services/services]) && ([file readable /home/NeoStats/neostats])} {
set ca [open "|/home/eggdrop/eggdrop"]
set cb [open "|/home/ircd/services/services"]
set cc [open "|/home/NeoStats/neostats"]
fconfigure $ca -blocking 0
fconfigure $cb -blocking 0
fconfigure $cc -blocking 0
fileevent $ca readable [list putserv "privmsg $nick :\[read $ca\]"; close $ca]
fileevent $cb readable [list putserv "privmsg $nick :\[read $cb\]"; close $cb]
fileevent $cc readable [list putserv "privmsg $nick :\[read $cc\]"; close $cc]
}
return 1
}
tessa1
Halfop
Posts: 49 Joined: Mon Apr 18, 2005 12:51 pm
Location: Germany
Post
by tessa1 » Thu Mar 30, 2006 1:07 pm
Don't work...
Tcl error [sne:start]: can not find channel named "file10"
ps x
29458 ? Z 0:00 [eggdrop] <defunct>
29459 ? Z 0:00 [services] <defunct>
29460 ? Z 0:00 [neostats] <defunct>
De Kus
Revered One
Posts: 1361 Joined: Sun Dec 15, 2002 11:41 am
Location: Germany
Post
by De Kus » Thu Mar 30, 2006 9:51 pm
I am sure demond wanted you to read about
seek which can be used to set the reading pointer at x bytes before eof. You cannot open text files with |. You can only open files with | which are marked as executable and can be run by bash as either script or application, otherwise you will get an error.
PS: i wouldnt use async IO on local files when reading less than ~1mb.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under
The MIT License
Love hurts, love strengthens...