It seems that my bot keeps dieing when "big" scripts are triggered. Such like pisg-0.5.tcl. Bot dies with error message "Ping timeout" when pisg is executed and log file is being analyzed.
The code should be okay, but why does bot die?
Another mixed script, that generates statistics but bot dies in middle of it:
Code: Select all
set pisgver "0.70"
#Location of pisg execuitable perl script
set pisgexe "/home/rix/pisg/pisg"
#URL of the generated stats
set pisgurl "http://www.starpump.ee/jutukas/stats"
#channel that the stats are generated for
set pisgchan "#starpump"
#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 "60"
set pisg_server "starpump.ee"
set pisg_user "user0071"
set pisg_pass "******"
set pisg_localdir "/home/rix/pisg/index.html"
set pisg_remotedir "stats"
bind pub $pisgflags !statsup pub:pisgcmd
proc pub:pisgcmd {nick host hand chan arg} {
global pisgexe pisgurl pisgchan
if {[catch {exec $pisgexe} error]} { append out "$pisgexe an error occured: [string totitle $error]" } else { append out "okay" }
if {$out == "okay"} {
puthelp "PRIVMSG $pisgchan :Statistika on edukalt koostatud, jätkan üleslaadimist..."
set pisg_localfile "$pisg_localdir"
set pisg_remotefile "$pisg_remotedir/index.html"
pisg_sendftp $pisg_localfile $pisg_server $pisg_user $pisg_pass $pisg_remotefile
}
else {
puthelp "PRIVMSG $pisgchan :$out"
}
puthelp "PRIVMSG $pisgchan :Statistika on üles laetud: $pisgurl"
}
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
}
proc pisg_sendftp { localfile server user pass remotefile } {
global pingcheck
if {![file exist $localfile]} {
return "sendftp: $localfile ei eksisteeri."
}
set noftp [catch {set ftpprog [exec which ftd]}]
if {$noftp} {
if {[file executable /usr/bin/ftp]} {
set ftpprog /usr/bin/ftp
set noftp 0
}
if {[file executable /bin/ftp]} {
set ftpprog /bin/ftp
set noftp 0
}
}
if {$noftp} { return "sendftp: Sul puudub 'ftp' tööriist" }
set pipe [open "|$ftpprog -n $server" w]
puts $pipe "user $user $pass"
puts $pipe "bin"
puts $pipe "put $localfile $remotefile"
puts $pipe "quit"
close $pipe
return 1
}
putlog "pisg.tcl $pisgver loaded"