Technical information

INSTALLATION AND ADMINISTRATION GUIDE
60
# Failover : VSI-FAX Device failure notification and Failover to FODC for Windows
#--------------------------------------------------------
set VSIFAX $env(VSIFAX)
# ------------------------------------------------------------------------
# Configurable globals
# ------------------------------------------------------------------------
set FODC_MAIN_DEVICE "FoDC"
set FODC_FAILOVER_DEVICE "FoDC2"
set EMAIL ""
global argv env
set DEVICE [lindex $argv 0]
set REASON [lindex $argv 1]
set TIMESTAMP [ clock format [ clock seconds ] -format {%Y/%m/%d %H:%M:%S} ]
set FAILOVER_DEVICE ""
# ------------------------------------------------------------------------
# Update log file & send a notification email
# ------------------------------------------------------------------------
if {[string length "$FAILOVER_DEVICE"] > 0} {
set ERROR "Device $DEVICE failed: $REASON. Enabling $FAILOVER_DEVICE"
} else {
set ERROR "Device $DEVICE failed: $REASON."
}
set f [ open $VSIFAX/spool/logs/devfail a+ ]
puts $f "$TIMESTAMP $ERROR"
close $f
if {[string length "$EMAIL"] > 0} {
#---------------------------------------------------------------------
# Create email file
#---------------------------------------------------------------------
set g [ open $VSIFAX/spool/temp/devfail w+ ]
puts $g "$TIMESTAMP $ERROR"
close $g
#---------------------------------------------------------------------
# Email notification to specified mail address
#---------------------------------------------------------------------
catch {exec "$VSIFAX/lbin/vmime" -t -s $ERROR "$VSIFAX/spool/temp/devfail" |
"$VSIFAX/lbin/vmail" -R $EMAIL $EMAIL}
file delete "$VSIFAX/spool/temp/devfail"
}
if {[string length "$FAILOVER_DEVICE"] > 0} {
#---------------------------------------------------------
# Fax on Demand failover management
#---------------------------------------------------------
catch {exec "$VSIFAX/bin/vfxadmin" enable $FAILOVER_DEVICE}
catch {puts stdout "Enabling $FAILOVER_DEVICE"}
}
else {
#---------------------------------------------------------
# Local device failover management:
# Issue command to set the FoDCClass as default queue
# and set the FoDC device as default device (enabled)
# and the FoDC2 device as failover device (disabled)
#-------------------------------------------------------
exec "$VSIFAX\\bin\\vfxadmin" class -u -d FodCClass
exec "$VSIFAX\\bin\\vfxadmin" device -u -d -E on FodC
exec "$VSIFAX\\bin\\vfxadmin" device -u -E off FodC2