-
- Downloads
Fix space comparison expression and use gigabytes for threshold.
Megabytes have shown to be a bit clumsy in the configuration files, so simply switch to the more useful Gigabytes unit. Fixes #39
Showing
- ATxCommon/Serializables/DriveToCheck.cs 1 addition, 1 deletionATxCommon/Serializables/DriveToCheck.cs
- ATxCommon/Serializables/ServiceConfig.cs 1 addition, 1 deletionATxCommon/Serializables/ServiceConfig.cs
- ATxCommon/SystemChecks.cs 8 additions, 4 deletionsATxCommon/SystemChecks.cs
- ATxService/Email.cs 4 additions, 2 deletionsATxService/Email.cs
- Resources/conf/host-specific.template.xml 3 additions, 3 deletionsResources/conf/host-specific.template.xml
... | @@ -80,12 +80,16 @@ namespace ATxCommon | ... | @@ -80,12 +80,16 @@ namespace ATxCommon |
var msg = ""; | var msg = ""; | ||
foreach (var driveToCheck in drives) { | foreach (var driveToCheck in drives) { | ||
var freeSpace = GetFreeDriveSpace(driveToCheck.DriveName); | var freeSpace = GetFreeDriveSpace(driveToCheck.DriveName); | ||
if (freeSpace >= driveToCheck.SpaceThreshold) | if (freeSpace >= driveToCheck.SpaceThreshold * Conv.GigaBytes) { | ||
|
|||
Log.Trace("Drive [{0}] free space: {1}, above threshold ({2})", | |||
driveToCheck.DriveName, Conv.BytesToString(freeSpace), | |||
Conv.GigabytesToString(driveToCheck.SpaceThreshold)); | |||
continue; | continue; | ||
} | |||
msg += "Drive '" + driveToCheck.DriveName + | msg += $"Drive [{driveToCheck.DriveName}] " + | ||
"' - free space: " + Conv.BytesToString(freeSpace) + | $"free space: {Conv.BytesToString(freeSpace)} " + | ||
" (threshold: " + Conv.BytesToString(driveToCheck.SpaceThreshold) + ")\n"; | $"(threshold: {Conv.GigabytesToString(driveToCheck.SpaceThreshold)})\n"; | ||
} | } | ||
return msg; | return msg; | ||
... | ... |