diff options
| author | Josef Gustafsson <josef.gson@gmail.com> | 2015-09-14 09:01:02 +0200 |
|---|---|---|
| committer | Josef Gustafsson <josef.gson@gmail.com> | 2015-09-14 09:01:02 +0200 |
| commit | 2e0ffd12b1ead4dd6ee9bad0725fd4296092fa1f (patch) | |
| tree | 5a01fc3103d3a70a52013b258a66eb43d073b7f4 /monitor | |
| parent | 8838d7ddee90eaed922ff6a0ecd3f922ef5e2b31 (diff) | |
error handling in main, save and exit on error
Diffstat (limited to 'monitor')
| -rwxr-xr-x | monitor/josef_monitor.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/monitor/josef_monitor.py b/monitor/josef_monitor.py index 14a280a..4b8b721 100755 --- a/monitor/josef_monitor.py +++ b/monitor/josef_monitor.py @@ -338,6 +338,7 @@ def main(args): if os.path.isfile(log.savefile): log.load() # Build what was not loaded + # try: for log in logs: log.incremental_build() @@ -353,16 +354,18 @@ def main(args): log.verify_consistency(old_sth) log.incremental_build() - # Unreachable... usually. - for log in logs: - log.save() - except KeyboardInterrupt: print time.strftime('%H:%M:%S') + ' Received interrupt from user. Saving and exiting....' for log in logs: log.save() + except: + # Unreachable... usually. + print "FATAL ERROR! Saving state and terminating!" + for log in logs: + log.save() + if __name__ == '__main__': |
