Ok this is my script, it currently watches a file for changes and then if there is a change it pubishes the file to the channel Right now it's giving errors too many files open plus is there a way for it reuses the same timer rather then a new one everytime.
thanks for any help you can provide.
#############################
# This is the postONE channel
#############################
set postONE(chan) "#weatheralerts"
#############################
# This is the filename
#############################
set postONE(filename) "tstormdata.txt"
#############################
# Time between checks in seconds
#############################
set postONE(time) 30
#############################
# Code begin
#############################
set postONE(check) 1
set postONE(modtime) [file mtime $postONE(filename)]
set double-help 1
proc postONE_start {} {
global postONE
set postONE(check) 1
postONE_check
}
proc postONE_check {} {
global postONE
if { $postONE(check) == 0 } { return }
set modtime [file mtime $postONE(filename)]
set thefile [open $postONE(filename)]
if { $modtime != $postONE(modtime) } {
while { [gets $thefile theline] != -1 } {
puthelp "PRIVMSG $postONE(chan) :$theline "
}
set postONE(modtime) $modtime
close $thefile
}
utimer $postONE(time) postONE_start
}
proc postONE_stop {} {
global postONE
set postONE(check) 0
}
postONE_start
Ok i'll first admit this script was wrote for me, i've edited it a bit but I don't know how to edit it to close the file each time.
FYI
[10:47:30pm] <AlertBot-> [22:43] Tcl error in script for 'timer1025':
[10:47:30pm] <AlertBot-> [22:43] couldn't open "tstormdata.txt": too many open files
[11:03:57pm] <AlertBot-> [23:00] ERROR writing user file.
[12:04:20am] <AlertBot-> [00:00] --- Thu Apr 20 2006