Select group based on AX system date
Posted by kyang
A customer wanted his AX to direct the traffic by AX system time.
Example: direct the traffic by AX date number,if the number is even then direct the traffic to sg-even,else to sg-odd.
Here is how:
Code:
-------------------------------------
when CLIENT_ACCEPTED {
set curdate [TIME::clock seconds]
set systemdate [clock format $curdate -format {%D}]
set datenumber [clock format $curdate -format {%d}]
set mod [ expr $datenumber%2 ]
log "System Date is $systemdate, Date number is $datenumber, the Mod result is $mod"
if { $mod eq "0"} {
log "Date number is even, forward to sg-even"
pool sg-even
} else {
log "Date number is odd,forward to sg-odd"
pool sg-odd
}
}
-------------------------------------
ke.yang
A customer wanted his AX to direct the traffic by AX system time.
Example: direct the traffic by AX date number,if the number is even then direct the traffic to sg-even,else to sg-odd.
Here is how:
Code:
-------------------------------------
when CLIENT_ACCEPTED {
set curdate [TIME::clock seconds]
set systemdate [clock format $curdate -format {%D}]
set datenumber [clock format $curdate -format {%d}]
set mod [ expr $datenumber%2 ]
log "System Date is $systemdate, Date number is $datenumber, the Mod result is $mod"
if { $mod eq "0"} {
log "Date number is even, forward to sg-even"
pool sg-even
} else {
log "Date number is odd,forward to sg-odd"
pool sg-odd
}
}
-------------------------------------
ke.yang
0