Created
July 31, 2009 23:16
-
-
Save dizzi/159502 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function writeToMonitor{ | |
write-host LOG: Last transfer $args[0] | |
} | |
$now = Get-Date 13:00 | |
$start = Get-Date 7:00 | |
$end = Get-Date 20:00 | |
if($now -gt $start -and $now -lt $end) { | |
$lastfile = Get-ChildItem d:\ | Sort-Object -Property LastWriteTime | Select-Object -First 1 | |
$mins = ($(Get-Date)-$lastfile.LastWriteTime).minutes | |
write-host Last tranfser was ${mins}mins ago | |
writeToMonitor $mins | |
} else { | |
write-host We are out of opeartion window, sending fake data to monitor | |
writeToMonitor 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment