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.

crontab.tcl ? is it possible?

Old posts that have not been replied to for several years.
Locked
User avatar
Thunderdome
Op
Posts: 187
Joined: Tue Mar 15, 2005 4:42 pm

crontab.tcl ? is it possible?

Post by Thunderdome »

Hello!
I would like to know how can I make a tcl in which the bot starts a process at certain times... kinda like a crontab using the eggdrop... (for people with no crontab in their shell).

for example:

./process blabla.conf

20 * * * blablbahajahah
45 * * * blablbahajahah
57 * * * blablbahajahah


I think you get my point.
greetz and thanks. :)
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

you can either use "exec bla" (not that bot will be stucked until the process terminates) or "open |bla" to open a file handle to that console (you use puts and gets to interact with whatever you started) but more important is, the bot won't wait till the process is terminated and will continue immidiadly.
You can read more about these in "The Manual" ^-^.
for binding for time you should read TCL-Commands.doc in the BIND section.
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...
User avatar
Thunderdome
Op
Posts: 187
Joined: Tue Mar 15, 2005 4:42 pm

Post by Thunderdome »

the problem is that I don't get it... I have a script that comes with pisg that does this well, but I dunno how to adapt it...

Code: Select all

#pisg.tcl v0.15 by HM2K - auto stats script for pisg (perl irc statistics generator)
#based on a script by Arganan
set pisgver "0.15"

#Location of pisg execuitable perl script
set pisgexe "/home/nf/pisg/pisg"

#URL of the generated stats
set pisgurl "http://stats.nemesisforce.com/"

#channel that the stats are generated for
set pisgchan "#nemesisforce"

#Users with these flags can operate this function
set pisgflags "nm"

#How often the stats will be updated in minutes, ie: 30 - stats will be updated every 30 minutes
set pisgtime "30"

bind pub $pisgflags !stats pub:pisgcmd

proc pub:pisgcmd {nick host hand chan arg} {
	global pisgexe pisgurl pisgchan
	append out "PRIVMSG $pisgchan :" ; if {[catch {exec $pisgexe} error]} { append out "$pisgexe an error occured: [string totitle $error]" } else { append out "Stats Updated: $pisgurl" }
	puthelp $out
}

proc pisgcmd_timer {} {
	global pisgexe pisgurl pisgchan pisgtime
	append out "PRIVMSG $pisgchan :" ; if {[catch {exec $pisgexe} error]} { append out "$pisgexe an error occured: [string totitle $error]" } else { append out "Stats Updated: $pisgurl" }
	puthelp $out
	timer $pisgtime pisgcmd_timer
}

if {![info exists {pisgset}]} {
  set pisgset 1
  timer 2 pisgcmd_timer
}

putlog "pisg.tcl $pisgver loaded"
How can I change this for another process? (yes, I don't know much about tcl) :\
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

Thunderdome wrote:

Code: Select all

set pisgexe "/home/nf/pisg/pisg"
...
if {[catch {exec $pisgexe} error]} {
  error handle here
} else {
  success handle here
}
How can I change this for another process? (yes, I don't know much about tcl) :\
thats where the executable is called.
the var name "error" will store whatever the executable has returned.
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...
User avatar
Thunderdome
Op
Posts: 187
Joined: Tue Mar 15, 2005 4:42 pm

Post by Thunderdome »

does not seem to work...
I even made

Code: Select all

global pisgurl pisgexe
with pisgurl as the log file address and pisgexe as the cfg address like in ./ircstats logfile.log config.cfg

I used the full address for the files... :\
Am I missing something?[/quote]
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

the pisgurl is only used to announce it to the channel, which is suppsed to point to the html/php which content/source has been just updated by the called pearl script.
depending on what you execute you might have to call bash like "exec /bin/bash -c \"bla\""

PS: don't tell me you get this error:
Tcl error: couldn't duplicate input handle: bad file number
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...
User avatar
Thunderdome
Op
Posts: 187
Joined: Tue Mar 15, 2005 4:42 pm

Post by Thunderdome »

hum.... But if I want to execute something like "./ircstats some.conf some.log" at 25 minutes then 45 minutes, how shall I do?
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

use bind time
User avatar
Thunderdome
Op
Posts: 187
Joined: Tue Mar 15, 2005 4:42 pm

Post by Thunderdome »

would you be kind enough to make me the code? :)
t
the_crow
Halfop
Posts: 42
Joined: Fri Feb 28, 2003 7:37 am
Location: Lisboa, Portugal

Post by the_crow »

Code: Select all

set pisgexe "/home/nf/pisg/pisg"

bind time - "00 * * * *" execution

proc execution {nick uhost hand chan} {
        global pisgexe
        eval exec $pisgexe
}
User avatar
Thunderdome
Op
Posts: 187
Joined: Tue Mar 15, 2005 4:42 pm

Post by Thunderdome »

Code: Select all

Tcl error [execution]: wrong # args: should be "execution nick uhost hand chan"
it gives me this error....


and here:

home/nf/pisg/pisg

the pisg in the end... how should the file be?
I have something like this:

Code: Select all

#!/bin/sh 
cd /home/shellname/IRCStats-1.0/
./ircstats /home/shellname/eggie/scripts/logs/blabla.log ircstats.cfg

is all this correct? What am I doing wrong?
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

TCL-Commands.doc -> BIND -> time
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...
Locked