mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-17 23:48:17 +02:00
Update check-swap-space.ps1
This commit is contained in:
parent
005613fe54
commit
17b2050c07
@ -1,6 +1,6 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Checks the free swap space
|
Checks the swap space
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This script checks the free swap space.
|
This script checks the free swap space.
|
||||||
.PARAMETER MinLevel
|
.PARAMETER MinLevel
|
||||||
@ -32,14 +32,14 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($Total -eq "0") {
|
if ($Total -eq "0") {
|
||||||
write-warning "No swap space configured!"
|
$Reply = "No swap space configured!"
|
||||||
exit 1
|
} elseif ($Free -lt $MinLevel) {
|
||||||
|
$Reply = "Swap space has only $Free GB left to use! ($Used of $Total GB used, minimum is $MinLevel GB)"
|
||||||
|
} else {
|
||||||
|
$Reply = "Swap space has $Free GB left ($Total GB total)"
|
||||||
}
|
}
|
||||||
if ($Free -lt $MinLevel) {
|
"✔️ $Reply"
|
||||||
write-warning "Swap space has only $Free GB left to use! ($Used of $Total GB used, minimum is $MinLevel GB)"
|
& "$PSScriptRoot/speak-english.ps1" "$Reply"
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
"✔️ Swap space has $Free GB left ($Total GB total)"
|
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||||
|
Loading…
Reference in New Issue
Block a user