diff options
author | Florian <stayawake@lavabit.com> | 2014-02-13 12:04:36 +0100 |
---|---|---|
committer | Florian <stayawake@lavabit.com> | 2014-02-13 12:04:36 +0100 |
commit | 963b45f4c04c4da390aa9faa12e82691ffcb2237 (patch) | |
tree | b86111074b9d9780244fd7ecec1c355845354b17 /scripts | |
parent | 2490960480bb39a5f775058119ba2a9eb42196fe (diff) |
status script checks now, if statusfile exists
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/status_script.py | 9 | ||||
-rw-r--r-- | scripts/sublab-doorstatus.last | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/scripts/status_script.py b/scripts/status_script.py index 0f218d9..739cfcf 100755 --- a/scripts/status_script.py +++ b/scripts/status_script.py @@ -109,9 +109,12 @@ if __name__ == '__main__': s = SublabStatus() # read file with last status - with open(STATUSFILE, 'r') as status_file: - old_status = status_file.readline().rstrip() - last_change = status_file.readline().rstrip() + try: + with open(STATUSFILE, 'r') as status_file: + old_status = status_file.readline().rstrip() + last_change = status_file.readline().rstrip() + except Exception: + save_statusfile(STATUSFILE, s.door_status()) # check if status changed, if yes, update css and tweet it if s.door_status() != old_status: diff --git a/scripts/sublab-doorstatus.last b/scripts/sublab-doorstatus.last deleted file mode 100644 index e97f71f..0000000 --- a/scripts/sublab-doorstatus.last +++ /dev/null @@ -1,2 +0,0 @@ -closed -today |