def __daemon(self): times = 0 path = os.path.join(config.DATAFILES_DIR, config.DUMP_FILE) while(self.loop): times += 1 print u"start regular backup of %d times" % times backup = Backup() backup.main() print "complete.\n%d files were backed up." % backup.numberOfFiles backup.numberOfFiles = 0 if os.path.exists(path): f = open(path) self.loop = pickle.load(f) f.close() else: self.loop = False time.sleep(self.interval) if os.path.exists(path): f = open(path) self.loop = pickle.load(f) f.close() else: self.loop = False
def backup(): print "start backup" backup = Backup() backup.main() print "%d files were backed up" % backup.numberOfFiles