diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/megacli_parser/megacli_parse.py b/megacli_parser/megacli_parse.py index 37bce19..018e1be 100644 --- a/megacli_parser/megacli_parse.py +++ b/megacli_parser/megacli_parse.py @@ -148,12 +148,18 @@ def f_get_ld_val(num, val, source): if __name__ == '__main__': if len(sys.argv) == 1 or len(sys.argv) == 3 or len(sys.argv) > 4: print("Wrong args. Cache will be updated if necessary") - stat_pd = os.stat(pd_file) - stat_ld = os.stat(ld_file) - if (float(time.time()) - float(stat_pd.st_ctime)) > 50: + if not os.path.exists(pd_file): f_read_cli(pd_cmd, pd_file) - if (float(time.time()) - float(stat_ld.st_ctime)) > 50: + else: + stat_pd = os.stat(pd_file) + if (float(time.time()) - float(stat_pd.st_ctime)) > 50: + f_read_cli(pd_cmd, pd_file) + if not os.path.exists(ld_file): f_read_cli(ld_cmd, ld_file) + else: + stat_ld = os.stat(ld_file) + if (float(time.time()) - float(stat_ld.st_ctime)) > 50: + f_read_cli(ld_cmd, ld_file) if len(sys.argv) == 2: if sys.argv[1] == "ld":