parser = optparse.OptionParser() parser = optparse.OptionParser() parser.add_option("-D", "--debug", dest="debug", default=False, help="Set DEBUG mode ON", action="store_true") parser.add_option("-e", "--results-dir", dest="video_dir", help="Where video files are stored") parser.add_option("-s", "--safe", dest="safe", default=False, help="Set Safe mode ON", action="store_true") (options, args) = parser.parse_args() option_dict = vars(options) VIDEO_DIR = option_dict["video_dir"] or CFG.content['folders'][ 'video']['path'] SAFE_MODE = option_dict["safe"] gbw = GenericBackupWrapper(backup_job, VIDEO_DIR, SAFE_MODE) gbw.run() except Exception as e: logging.error(traceback.format_exc())
if ethoscope: all_devices = receive_devices(server) bj = None for devID in all_devices: try: ethoscope = int(ethoscope) condition = all_devices[devID]['name'] == ( "ETHOSCOPE_%03d" % ethoscope ) and all_devices[devID]['status'] != "offline" except ValueError as e: condition = all_devices[devID]['name'] == ( f"ETHOSCOPE_{ethoscope}" ) and all_devices[devID]['status'] != "offline" if condition: print( f"Forcing backup for ethoscope ETHOSCOPE_{ethoscope}") bj = backup_job((all_devices[devID], RESULTS_DIR)) if bj == None: exit(f"ETHOSCOPE_{ethoscope} is not online or not detected") else: gbw = GenericBackupWrapper(backup_job, RESULTS_DIR, SAFE_MODE, server, regex) gbw.run() except Exception as e: logging.error(traceback.format_exc())
default="192.169.123.0", help="the ip of the router in your setup") parser.add_option("-s", "--safe", dest="safe", default=False, help="Set Safe mode ON", action="store_true") parser.add_option( "-l", "--local", dest="local", default=False, help= "Run on localhost (run a node and device on the same machine, for development)", action="store_true") (options, args) = parser.parse_args() option_dict = vars(options) local_ip = get_local_ip(option_dict["subnet_ip"], localhost=option_dict["local"]) (options, args) = parser.parse_args() option_dict = vars(options) gbw = GenericBackupWrapper(backup_job, option_dict["results_dir"], option_dict["safe"], local_ip) gbw.run() except Exception as e: logging.error(traceback.format_exc(e))
logging.error("Unexpected error in backup. args are: %s" % str(args)) logging.error(traceback.format_exc()) if __name__ == '__main__': CFG = EthoscopeConfiguration() logging.getLogger().setLevel(logging.INFO) try: parser = optparse.OptionParser() parser = optparse.OptionParser() parser.add_option("-D", "--debug", dest="debug", default=False, help="Set DEBUG mode ON", action="store_true") parser.add_option("-e", "--results-dir", dest="results_dir", help="Where result files are stored") parser.add_option("-s", "--safe", dest="safe", default=False,help="Set Safe mode ON", action="store_true") (options, args) = parser.parse_args() option_dict = vars(options) RESULTS_DIR = option_dict["results_dir"] or CFG.content['folders']['results']['path'] SAFE_MODE = option_dict["safe"] gbw = GenericBackupWrapper(backup_job, RESULTS_DIR, SAFE_MODE) gbw.run() except Exception as e: logging.error(traceback.format_exc())