#! /usr/bin/env mpscript # # This script runs the requested scan from the specified scan database. # import MpScan def main( record_list, argv ): if ( len(argv) != 2 ): print( "" ) print( "Usage: mp_scan scan_name scan_datafile" ) print( "" ) sys.exit(1); scan_name = argv[0] scan_database = argv[1] # Load the scan database. MpScan.load_scans( record_list, scan_database, 1 ) Mp.info( "Scan database '%s' successfully read." % ( scan_database ) ) # Find the individual scan. scan = record_list.get_record( scan_name ) # Run the scan. Catch exceptions so that the scan database will # be updated even if the scan aborts. Mp.info( "Starting scan '%s'." % ( scan_name ) ) try: scan.perform_scan() except: pass # Update the scan database so that any changes in datafile names # are preserved. MpScan.save_scans( record_list, scan_database ) Mp.info( "Scan database '%s' successfully updated." % ( scan_database ))