Runs doctor storage command.

@return 0 on success, 1 otherwise
507983
public int run() throws IOException {
    List<WorkerLostStorageInfo> workerLostStorageList = mBlockMasterClient.getWorkerLostStorage();
    if (workerLostStorageList.size() == 0) {
      mPrintStream.println("All worker storage paths are in working state.");
      return 0;
    }
    for (WorkerLostStorageInfo info : workerLostStorageList) {
      Map<String, StorageList> lostStorageMap = info.getLostStorageMap();
      if (lostStorageMap.size() != 0) {
        mPrintStream.printf("The following storage paths are lost in worker %s: %n",
            info.getAddress().getHost());
        for (Map.Entry<String, StorageList> tierStorage : lostStorageMap.entrySet()) {
          for (String storage : tierStorage.getValue().getStorageList()) {
            mPrintStream.printf("%s (%s)%n", storage, tierStorage.getKey());
          }
        }
      }
    }
    return 0;
  }
1116221
public void run() {

        System.out.println(HORIZONTAL_RULE);
        System.out.println(" Getting initial database partition count");
        long partitionCount = 0;
        try {
            VoltTable results[] = client.callProcedure("@GetPartitionKeys", "integer").getResults();
            partitionCount = results[0].getRowCount();
            updatePartitionCount(partitionCount);
        } catch (IOException | ProcCallException e) {
            System.out.print(HORIZONTAL_RULE);
            System.out.println("Could not get partition information. Processing terminated. Error:" + e.getMessage());
            e.printStackTrace();
            shutdown();
            System.out.print(HORIZONTAL_RULE);
            return;
        }
        System.out.println(" Initial database partition count: " + partitionCount);
        System.out.print(HORIZONTAL_RULE);
        System.out.println(" Starting Processing");
        System.out.println(HORIZONTAL_RULE);

        // Print periodic stats/analysis to the console
        scheduler.scheduleWithFixedDelay(reporter,
                                               config.displayinterval,
                                               config.displayinterval,
                                               TimeUnit.SECONDS);

        if (!config.inline) {
            // Delete data as often as need be
            //  -- This will resubmit itself at varying rates according to insert load
            scheduler.execute(deleter);
        }

        // Start tracking changes to the maximum value after a 5 second delay to
        // let things settle a bit. Then check up to 100 times per second.
        scheduler.scheduleWithFixedDelay(maxTracker,
                                               5000,
                                               10,
                                               TimeUnit.MILLISECONDS);

        // Run the benchmark loop for the requested duration
        // The throughput may be throttled depending on client configuration
        inserter.run();

        System.out.print(HORIZONTAL_RULE);
        System.out.println(" Processing Complete");
        System.out.println(HORIZONTAL_RULE);

        shutdown();
    }
244163
public int run(CommandLine cl) throws IOException {
    if (cl.hasOption(ReportCommand.HELP_OPTION_NAME)) {
      System.out.println(getUsage());
      return 0;
    }

    GetWorkerReportOptions options = getOptions(cl);
    generateCapacityReport(options);
    return 0;
  }
846945
public long count(){
        try {   
        	long count = 0;
        	if(isCluster(groupName)){
        		count = getBinaryJedisClusterCommands(groupName).zcard(keyBytes);
        	}else{
        		count = getBinaryJedisCommands(groupName).zcard(keyBytes);
        	}
			return count;
    	} finally{
			getJedisProvider(groupName).release();
		}
	}
1238080
public function execute()
    {
        $success = true;
        foreach ($this->commandList as $command) {
            if (!$this->runSingleCommand($command)) {
                $success = false;
                break;
            }
        }
        return $success;
    }
847429
@Override
	public void run()
    {
        String command = globalSettings.getStringProperty(FFMQAdminClientSettings.ADM_COMMAND, null);
        if (StringTools.isEmpty(command))
        {
            err.println("No command specified");
            return;
        }
        
        try
        {
            openSession();
            processCommand(command);
        }
        catch (JMSException e)
        {
        	logError(e);
        }
        finally
        {
        	closeSession();
        }
    }
1275084
public function cmdDeleteCollection()
    {
        $id = $this->getParam(0);
        $all = $this->getParam('all');

        if (empty($id) && empty($all)) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        $options = null;

        if (isset($id)) {

            if ($this->getParam('type')) {
                $options = array('type' => $id);
            } else if ($this->getParam('store')) {

                if (!is_numeric($id)) {
                    $this->errorAndExit($this->text('Invalid argument'));
                }

                $options = array('store_id' => $id);
            }

        } else if (!empty($all)) {
            $options = array();
        }

        if (isset($options)) {

            $deleted = $count = 0;
            foreach ($this->collection->getList($options) as $item) {
                $count++;
                $deleted += (int) $this->collection->delete($item['collection_id']);
            }

            $result = $count && $count == $deleted;

        } else {

            if (!is_numeric($id)) {
                $this->errorAndExit($this->text('Invalid argument'));
            }

            $result = $this->collection->delete($id);
        }

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        $this->output();
    }
634272
public int run() {
        if (outfile == null && compare == null)
            return CommandLineArguments.STATUS_NO_OUTPUT_OR_COMPARISON;
        if (infile == null && generator == null && merge == null)
            return CommandLineArguments.STATUS_NO_INPUT;

        if ((infile == "-") && (bindings == "-"))
            throw new InteropException(
                    "Cannot use standard input for both infile and bindings");

        Document doc;
        if (infile != null) {
            doc = doReadDocument(infile, informat);
        } else if (merge != null) {
            IndexedDocument iDoc = new IndexedDocument(pFactory,
                                                       pFactory.newDocument(),
                                                       flatten != null);
            try {
                List<ToRead> files;
                if (merge.equals("-")) {
                    files = readIndexFile(System.in);
                } else {
                    files = readIndexFile(new File(merge));
                }
                System.err.println("files to merge " + files);
                for (ToRead something : files) {
                    iDoc.merge(readDocument(something));
                }

            } catch (IOException e) {
                System.err.println("problem reading index file");
                e.printStackTrace();

            }
            doc = iDoc.toDocument();

        } else {

            String[] options = generator.split(":");
            String noOfNodes = getOption(options, 0);
            String noOfEdges = getOption(options, 1);
            String firstNode = getOption(options, 2);
            String namespace = "http://expample.org/";
            String seed = getOption(options, 3);
            String term = getOption(options, 4);

            if (term == null)
                term = "e1";

            GeneratorDetails gd = new GeneratorDetails(
                                                       Integer.valueOf(noOfNodes),
                                                       Integer.valueOf(noOfEdges),
                                                       firstNode,
                                                       namespace,
                                                       (seed == null) ? null
                                                               : Long.valueOf(seed),
                                                               term);
            System.err.println(gd);
            GraphGenerator gg = new GraphGenerator(gd, pFactory);
            gg.generateElements();

            doc = gg.getDetails().getDocument();
        }

        if (compare!=null) {
            return doCompare(doc,doReadDocument(compare, informat));
        } 
        
        if (template!=null) {
            BindingsBeanGenerator bbgen=new BindingsBeanGenerator(pFactory);
            
            boolean val=bbgen.generate(doc, template, packge, outfile, location);
            return (val) ? 0 : CommandLineArguments.STATUS_BEAN_GENERATION;
        }

        if (index != null) {
            Document indexedDoc = new IndexedDocument(pFactory, doc,
                                                      (flatten != null)).toDocument();
            doc = indexedDoc;
        }
        if (bindings != null) {
            Expand myExpand=new Expand(pFactory, addOrderp,allExpanded);
            Document expanded;
            System.err.println("bindings version is " + bindingsVersion);
            if (bindingsVersion==3) {
                Bindings bb=BindingsJson.fromBean(BindingsJson.importBean(new File(bindings)),pFactory);
                expanded = myExpand.expander(doc,
                                             bb);

            } else {
                Document docBindings = (Document) doReadDocument(bindings,
                                                                 bindingformat);
                expanded = myExpand.expander(doc,
                                             outfile,
                                             docBindings);
            }
            boolean flag=myExpand.getAllExpanded();
            doWriteDocument(outfile, outformat, expanded);

            if (!flag) {
                return CommandLineArguments.STATUS_TEMPLATE_UNBOUND_VARIABLE;
            }
        } else {
            doWriteDocument(outfile, outformat, doc);
        }
        return CommandLineArguments.STATUS_OK;

    }
1138984
public void run() {
        while (continueBackup) {
            if (changedListVersion < changedList.getVersion()) {
                cleanupBackupDir(SAVED_BACKUPS);
                String filename = String.valueOf(System.currentTimeMillis());
                File persistFile = new File(backupDir, filename);
                backingUp = true;
                changedListVersion = changedList.persist(persistFile);
                backingUp = false;
            }

            sleepAndCheck(backupFrequency);
        }
    }
785988
public Record []
run() {
	if (done)
		reset();
	if (name.isAbsolute())
		resolve(name, null);
	else if (searchPath == null)
		resolve(name, Name.root);
	else {
		if (name.labels() > defaultNdots)
			resolve(name, Name.root);
		if (done)
			return answers;

		for (int i = 0; i < searchPath.length; i++) {
			resolve(name, searchPath[i]);
			if (done)
				return answers;
			else if (foundAlias)
				break;
		}
	}
	if (!done) {
		if (badresponse) {
			result = TRY_AGAIN;
			error = badresponse_error;
			done = true;
		} else if (timedout) {
			result = TRY_AGAIN;
			error = "timed out";
			done = true;
		} else if (networkerror) {
			result = TRY_AGAIN;
			error = "network error";
			done = true;
		} else if (nxdomain) {
			result = HOST_NOT_FOUND;
			done = true;
		} else if (referral) {
			result = UNRECOVERABLE;
			error = "referral";
			done = true;
		} else if (nametoolong) {
			result = UNRECOVERABLE;
			error = "name too long";
			done = true;
		}
	}
	return answers;
}
812546
public function run() {

		$registryKey = $this->generateRegistryItemKey();

		if (!count($this->filteredBy) && !$this->jsonStorage->getLength($this->registry)) {
			return;
		}

		echo "<tr>\n";
		$cols = count($this->grid->columns);
		echo "<td colspan='{$cols}'>\n";
		echo "<div id='{$this->getId()}'>\n";
		if (count($this->filteredBy)) {
			echo '<p><span class="label label-success">Filtered by</span> ' . $this->displayExtendedFilterValues(
				$this->filteredBy
			) . '</p>';
		}

		$this->displaySaveButton($registryKey);
		$this->displaySavedFilters($registryKey);

		echo "</div>\n";
		echo "</td>\n";
		echo "</tr>\n";
	}
15833
public function run()
    {
        Model::unguard();

        // Save the permissions
        $group = Sentinel::findRoleBySlug('admin');

        $group->addPermission('product.products.index');
        $group->addPermission('product.products.create');
        $group->addPermission('product.products.edit');
        $group->addPermission('product.products.destroy');

        $group->addPermission('product.categories.index');
        $group->addPermission('product.categories.create');
        $group->addPermission('product.categories.edit');
        $group->addPermission('product.categories.destroy');

        $group->addPermission('product.storages.index');
        $group->addPermission('product.storages.create');
        $group->addPermission('product.storages.edit');
        $group->addPermission('product.storages.destroy');

        $group->save();
    }
1231683
function run()
    {
        switch ($this->cmd) {
            case 'generate':
                return $this->cmdGenerate();
                break;

            case 'list':
                return $this->cmdList();
                break;

            default:
                echo "\n\n  Command \"key:".$this->cmd."\" not exists!";
                exit(Main::help());
                break;
        }
        return;
    }
534643
public int run(String[] args) {
        int exitCode = 0;
        final CliParser cli = new CliParser(settings);

        try {
            cli.parse(args);
        } catch (FileNotFoundException ex) {
            System.err.println(ex.getMessage());
            cli.printHelp();
            return -1;
        } catch (ParseException ex) {
            System.err.println(ex.getMessage());
            cli.printHelp();
            return -2;
        }

        if (cli.getVerboseLog() != null) {
            prepareLogger(cli.getVerboseLog());
        }

        if (cli.isPurge()) {
            if (cli.getConnectionString() != null) {
                LOGGER.error("Unable to purge the database when using a non-default connection string");
                exitCode = -3;
            } else {
                try {
                    populateSettings(cli);
                } catch (InvalidSettingException ex) {
                    LOGGER.error(ex.getMessage());
                    LOGGER.debug("Error loading properties file", ex);
                    exitCode = -4;
                    return exitCode;
                }
                final File db;
                try {
                    db = new File(settings.getDataDirectory(), settings.getString(Settings.KEYS.DB_FILE_NAME, "odc.mv.db"));
                    if (db.exists()) {
                        if (db.delete()) {
                            LOGGER.info("Database file purged; local copy of the NVD has been removed");
                        } else {
                            LOGGER.error("Unable to delete '{}'; please delete the file manually", db.getAbsolutePath());
                            exitCode = -5;
                        }
                    } else {
                        LOGGER.error("Unable to purge database; the database file does not exist: {}", db.getAbsolutePath());
                        exitCode = -6;
                    }
                } catch (IOException ex) {
                    LOGGER.error("Unable to delete the database");
                    exitCode = -7;
                } finally {
                    settings.cleanup();
                }
            }
        } else if (cli.isGetVersion()) {
            cli.printVersionInfo();
        } else if (cli.isUpdateOnly()) {
            try {
                populateSettings(cli);
            } catch (InvalidSettingException ex) {
                LOGGER.error(ex.getMessage());
                LOGGER.debug("Error loading properties file", ex);
                exitCode = -4;
                return exitCode;
            }
            try {
                runUpdateOnly();
            } catch (UpdateException ex) {
                LOGGER.error(ex.getMessage(), ex);
                exitCode = -8;
            } catch (DatabaseException ex) {
                LOGGER.error(ex.getMessage(), ex);
                exitCode = -9;
            } finally {
                settings.cleanup();
            }
        } else if (cli.isRunScan()) {
            try {
                populateSettings(cli);
            } catch (InvalidSettingException ex) {
                LOGGER.error(ex.getMessage());
                LOGGER.debug("Error loading properties file", ex);
                exitCode = -4;
                return exitCode;
            }
            try {
                final String[] scanFiles = cli.getScanFiles();
                if (scanFiles != null) {
                    exitCode = runScan(cli.getReportDirectory(), cli.getReportFormat(), cli.getProjectName(), scanFiles,
                            cli.getExcludeList(), cli.getSymLinkDepth(), cli.getFailOnCVSS());
                } else {
                    LOGGER.error("No scan files configured");
                }
            } catch (DatabaseException ex) {
                LOGGER.error(ex.getMessage());
                exitCode = -11;
            } catch (ReportException ex) {
                LOGGER.error(ex.getMessage());
                exitCode = -12;
            } catch (ExceptionCollection ex) {
                if (ex.isFatal()) {
                    exitCode = -13;
                    LOGGER.error("One or more fatal errors occurred");
                } else {
                    exitCode = -14;
                }
                for (Throwable e : ex.getExceptions()) {
                    if (e.getMessage() != null) {
                        LOGGER.error(e.getMessage());
                        LOGGER.debug("unexpected error", e);
                    }
                }
            } finally {
                settings.cleanup();
            }
        } else {
            cli.printHelp();
        }
        return exitCode;
    }
243739
@Override
    public void run() {
        try {
            VoltTable partitionKeys = null;
            partitionKeys = m_client.callProcedure("@GetPartitionKeys", "INTEGER").getResults()[0];

            while (partitionKeys.advanceRow()) {
                m_client.callProcedure(new NullCallback(), "DeleteOldAdRequests",
                        partitionKeys.getLong("PARTITION_KEY"),
                        m_expiredAgeInSeconds);
            }

            m_client.callProcedure(new NullCallback(), "DeleteExpiredBids");
        }
        catch (IOException | ProcCallException ex) {
            ex.printStackTrace();
        }
    }
531839
public function execute() {
        global $DB;

        // Check if the category bin is disabled or there is no expiry time.
        $lifetime = get_config('tool_recyclebin', 'categorybinexpiry');
        if (!\tool_recyclebin\category_bin::is_enabled() || $lifetime <= 0) {
            return true;
        }

        // Get the items we can delete.
        $items = $DB->get_recordset_select('tool_recyclebin_category', 'timecreated <= :timecreated',
            array('timecreated' => time() - $lifetime));
        foreach ($items as $item) {
            mtrace("[tool_recyclebin] Deleting item '{$item->id}' from the category recycle bin ...");
            $bin = new \tool_recyclebin\category_bin($item->categoryid);
            $bin->delete_item($item);
        }
        $items->close();

        return true;
    }
336879
@Override
    public void run() {
        Collections.sort(files);
        for (int i = files.size() - 1; i >= 0; i--) {
            new File(files.get(i)).delete();
        }
    }