83 import signal, os |
84 import signal, os |
84 |
85 |
85 backupconfigs=config.settings['backups'] |
86 backupconfigs=config.settings['backups'] |
86 backups=[None]*len(backupconfigs); |
87 backups=[None]*len(backupconfigs); |
87 |
88 |
88 for i in range(len(backupconfigs)): |
89 try: |
89 logger.info('Setting up backup set %d' % i) |
90 for i in range(len(backupconfigs)): |
90 backups[i]=Backup(i, backupconfigs[i]) |
91 logger.info('Setting up backup set %d' % i) |
91 backups[i].schedule() |
92 backups[i]=Backup(i, backupconfigs[i]) |
|
93 backups[i].schedule() |
92 |
94 |
93 if args.notray or platform.system()!='Darwin': |
95 if args.notray or platform.system()!='Darwin': |
94 pass |
96 pass |
95 else: |
97 else: |
96 from ui import BorgendTray |
98 from ui import BorgendTray |
97 tray=BorgendTray(backups); |
99 tray=BorgendTray(backups); |
98 tray.run() |
100 tray.run() |
99 |
101 finally: |
|
102 for i in range(len(backups)): |
|
103 if backups[i]: |
|
104 backups[i].abort() |
|
105 backups=[] |
100 except Exception as err: |
106 except Exception as err: |
101 utils.log_exception(logger, err, detail='Exiting') |
107 utils.log_exception(logger, err, detail='Exiting') |
102 logging.shutdown() |
108 if tray: |
103 os.exit() |
109 tray.quit() |
|
110 else: |
|
111 logging.shutdown() |
|
112 #sys.exit() |
104 |
113 |
105 # |
114 # |
106 # This shit is fucked, disables ^C etc., and threading doesn't seem to help |
115 # This shit is fucked, disables ^C etc., and threading doesn't seem to help |
107 # |
116 # |
108 |
117 |