[Sguil-cvs] sguil/server/lib SguildUtils.tcl,1.8,1.9
Status: Beta
Brought to you by:
bamm
From: Bamm V. <ba...@us...> - 2005-09-28 15:46:06
|
Update of /cvsroot/sguil/sguil/server/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9364/lib Modified Files: SguildUtils.tcl Log Message: Emailing of events config now in own file (sguild.email) so it can be resourced on HUP. Index: SguildUtils.tcl =================================================================== RCS file: /cvsroot/sguil/sguil/server/lib/SguildUtils.tcl,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SguildUtils.tcl 15 Sep 2005 20:22:34 -0000 1.8 --- SguildUtils.tcl 28 Sep 2005 15:45:49 -0000 1.9 *************** *** 22,26 **** proc HupTrapped {} { global AUTOCAT_FILE GLOBAL_QRY_FILE GLOBAL_QRY_LIST clientList REPORT_QRY_FILE REPORT_QRY_LIST ! global acRules acCat ACCESS_FILE LogMessage "HUP signal caught." # Reload auto cat rules --- 22,26 ---- proc HupTrapped {} { global AUTOCAT_FILE GLOBAL_QRY_FILE GLOBAL_QRY_LIST clientList REPORT_QRY_FILE REPORT_QRY_LIST ! global acRules acCat ACCESS_FILE EMAIL_FILE LogMessage "HUP signal caught." # Reload auto cat rules *************** *** 32,35 **** --- 32,39 ---- LoadAutoCatFile $AUTOCAT_FILE } + if { [file exists $EMAIL_FILE] } { + LoadEmailConfig $EMAIL_FILE + InfoMessage "Email config loaded: $EMAIL_FILE" + } # reload global queries. InfoMessage "Reloaded Global Queries: $GLOBAL_QRY_FILE" *************** *** 174,177 **** --- 178,215 ---- } + #Reads file and sets email options + proc LoadEmailConfig { fileName } { + + global EMAIL_EVENTS SMTP_SERVER EMAIL_RCPT_TO + global EMAIL_FROM EMAIL_SUBJECT EMAIL_MSG + + set i 0 + + for_file line $fileName { + + incr i + + if { ![regexp {^#} $line] && ![regexp {^$} $line] && ![regexp {^\s+$} $line] } { + + if { [llength $line] != 3 || [lindex $line 0] != "set" } { + + ErrorMessage "Error at line $i in $fileName: $line" + + } else { + + if { [catch {eval $line} evalError] } { + + ErrorMessage "Error parsing line $i in $fileName: $line\n\t$evalError" + + } + + } + + } + + } + + } + # Reads file and adds queries to GLOBAL_QRY_LIST proc LoadGlobalQueries { fileName } { |