Commit 7b1dbc34 authored by Hiro's avatar Hiro 🏄
Browse files

Fix gettor check script

parent e4278339
...@@ -100,14 +100,18 @@ if __name__ == "__main__": ...@@ -100,14 +100,18 @@ if __name__ == "__main__":
else: else:
password = "yourPassword" password = "yourPassword"
status_file = open(STATUS_FILE,'w') status_file = open(STATUS_FILE, 'r')
message = status_file.read()
status_file.close()
try: try:
status, message = send_email_from_gmail(password) status, message = send_email_from_gmail(password)
except Exception as e: except Exception as e:
status = UNKNOWN status = UNKNOWN
message = repr(e) message = repr(e)
status_file.write("UNKNOWN: %s" % message) status_file = open(STATUS_FILE,'w')
status_file.write("UNKNOWN\n3: %s" % message)
status_file.close()
time.sleep(600) time.sleep(600)
...@@ -119,6 +123,7 @@ if __name__ == "__main__": ...@@ -119,6 +123,7 @@ if __name__ == "__main__":
status = CRITICAL status = CRITICAL
message = repr(e) message = repr(e)
finally: finally:
status_file = open(STATUS_FILE,'w')
if status == OK: if status == OK:
status_file.write("OK\n0: %s" % message) status_file.write("OK\n0: %s" % message)
elif status == WARNING: elif status == WARNING:
...@@ -129,4 +134,6 @@ if __name__ == "__main__": ...@@ -129,4 +134,6 @@ if __name__ == "__main__":
status_file.write("UNKNOWN\n3: %s" % message) status_file.write("UNKNOWN\n3: %s" % message)
status = UNKNOWN status = UNKNOWN
status_file.close()
sys.exit(status) sys.exit(status)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment