diff --git a/df_check.py b/df_check.py index 85667fb..52183cf 100755 --- a/df_check.py +++ b/df_check.py @@ -4,13 +4,23 @@ import os -#reading needed files -file = open("/proc/partitions", "r") -parts = file.read() -file.close() -file = open("/proc/mounts", "r") -mounts = file.read() -file.close() +# reading a file +def fileparser(path): + file = open(path, "r") + result = file.read() + file.close() + return result + +#file = open("/proc/partitions", "r") +#parts = file.read() +#file.close() +#file = open("/proc/mounts", "r") +#mounts = file.read() +#file.close() + +# reading needed files +parts = fileparser("/proc/partitions") +mounts = fileparser("/proc/mounts") partitions = []