close descriptors

Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
Jack L. Frost 2016-10-14 14:35:53 +03:00
parent 09dea79ab2
commit c772ed8ce3
2 changed files with 3 additions and 0 deletions

View File

@ -5,6 +5,7 @@ class LoadAverage < Worker
while true do while true do
file = File.open("/proc/loadavg", "r") file = File.open("/proc/loadavg", "r")
la_m = file.gets.split[0] la_m = file.gets.split[0]
file.close
if la_m.to_i > @my_config['crit_value'] if la_m.to_i > @my_config['crit_value']
fg_colour = @my_config['crit_colour'] fg_colour = @my_config['crit_colour']

View File

@ -21,6 +21,8 @@ class Network < Worker
net_ok = o.each_line.count net_ok = o.each_line.count
i.close; o.close
if net_ok == hosts.count if net_ok == hosts.count
status = "ok" status = "ok"
fg_colour = @my_config['ok_colour'] fg_colour = @my_config['ok_colour']