All pastes #427649 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-04-06 22:16 UTC
rendered paste body
## Version 20060721 01h46

# Check interval
set checkInterval 5

# Log file (FTP log file)
set logFile "/g6.log"

# Main log file (kept until you delete it)
set mainLogFile "/mainLogFile.log"

# Channel to send messages
set channel "#one"
set channeltwo "#two"
set channelthree "#three"

# No need to edit from here on
#Temp file
set tempLogFile "tempFile.log"

utimer 10 threeFiles

proc threeFiles {} {
		global logFile tempLogFile mainLogFile channel checkInterval channeltwo channelthree 
		# If main log file does not exist, it creates it
		if {[file exists $logFile]} {
				file rename $logFile $tempLogFile
				set tempFile [open $tempLogFile r]
				set mainFile [open $mainLogFile a+]
				while {![eof $tempFile]} {
						set currentLine [gets $tempFile]
						if {[string equal $currentLine ""]} {
								puts -nonewline $mainFile "\r\n"
#								putserv "PRIVMSG $channel :Empty Line in Log File" 
						} else {
								puts -nonewline $mainFile [append currentLine "\r\n"]
								putserv "PRIVMSG $channel :$currentLine"
								putserv "PRIVMSG $channeltwo :$currentLine"
								putserv "PRIVMSG $channelthree :$currentLine"
						}
				}
				close $tempFile
				close $mainFile
		}
		file delete $tempLogFile
		utimer $checkInterval threeFiles
}



putlog "Simple 3 Files TCL Loaded"