2019-09-14 22:12:56 +04:00

11 lines
320 B
Haskell
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import System.Exit
main :: IO ()
main = do
freeMemory <- read
<$> (!!1) <$> words
<$> (!!2) <$> lines
<$> readFile "/proc/meminfo"
putStr $ (take 5 $ show $ freeMemory / 1048576) ++ "GiB"
exitWith $ if freeMemory > 500000 then ExitSuccess else ExitFailure 33