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.

Execute a raw command after x minutes / write result to file

Old posts that have not been replied to for several years.
Locked
S
Sergios
Voice
Posts: 14
Joined: Fri Jul 23, 2004 2:48 pm

Execute a raw command after x minutes / write result to file

Post by Sergios »

Is it possible to make a script execute a raw command like /admin every x minuters and the result of this command write automatically to admin.html?? I have try but i get errors with raw command.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

it is:

Code: Select all

bind raw - * myraw
bind time - "00 % % % %" {set f [open foo.txt w]; putserv admin;#} 
proc myraw {f k t} {
  if [string match 25\[6-9\] $k] {puts $::f [join [lrange [split $t] 1 e]]}
  if {$k == 259} {close $::f}
}
S
Sergios
Voice
Posts: 14
Joined: Fri Jul 23, 2004 2:48 pm

Post by Sergios »

It doesnt write anything into the foo.txt file. It create the file but the file is still empty. Any suggestion??
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

I thought eggdrop matches raw bind mask with wildcards; turns out that's not the case; from src/mod/server.mod/servmsg.c:

Code: Select all

  x = check_tcl_bind(H_raw, code, 0, " $_raw1 $_raw2 $_raw3",
                     MATCH_EXACT | BIND_STACKABLE | BIND_WANTRET);
so, it's not MATCH_MASK as I thought it would be (and should be, IMO)

so, the solution will become:

Code: Select all

bind raw - 256 myraw
bind raw - 257 myraw
bind raw - 258 myraw
bind raw - 259 myraw
bind time - "00 % % % %" {set f [open foo.txt w]; putserv admin;#}
proc myraw {f k t} {
  puts $::f [string trimleft [join [lrange [split $t] 1 e]] :]
  if {$k == 259} {close $::f}
}
S
Sergios
Voice
Posts: 14
Joined: Fri Jul 23, 2004 2:48 pm

Post by Sergios »

I add the numerics of binds that you give me (there same as numerics server) but the file is still empty. Any sollution?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

it works on my bot

check whether your server's numerics for ADMIN reply are the same, if your server replies to /admin at all, and if there's no lag
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

oh, and in case you haven't noticed - the code I gave you writes to file once every hour, on top of the hour; if you need it to be triggered more frequently, tweak the time bind or use timer
S
Sergios
Voice
Posts: 14
Joined: Fri Jul 23, 2004 2:48 pm

Post by Sergios »

Yes, i see timer, i change it to see if it works. Yes on dalnet it works, but on unrealircd it doesnt work. the numerics on unreal are
#define RPL_ADMINME 256
#define RPL_ADMINLOC1 257
#define RPL_ADMINLOC2 258
#define RPL_ADMINEMAIL 259
The binds that you have.
Locked