コード例 #1
0
function dmn_enable($dmnpid, $dmntoenable)
{
    foreach ($dmntoenable as $uname) {
        echo "Enabling {$uname}: ";
        if (dmn_finduname($dmnpid, $uname)) {
            $conf = new DashConfig($uname);
            if ($conf->getmnctlconfig('enable') == 1) {
                echo "Already enabled";
            } else {
                $conf->setmnctlconfig('enable', 1);
                if ($conf->saveconfig() !== false) {
                    echo "Done";
                } else {
                    echo "Failed";
                }
            }
        } else {
            echo "Unknown Dash MasterNode";
        }
        echo "\n";
    }
}
コード例 #2
0
if (is_dir($nodepath1)) {
    $nodepath = $nodepath1;
} elseif (is_dir($nodepath2)) {
    $nodepath = $nodepath2;
} elseif (is_dir($nodepath3)) {
    $nodepath = $nodepath3;
} else {
    xecho("Directory {$nodepath3} not found.\n");
    die(1);
}
if (file_exists($outputfile)) {
    xecho("Output file already exists. Aborting.\n");
    die(5);
}
xecho("Loading configuration for {$uname}: ");
$conf = new DashConfig($uname);
if ($conf->isConfigLoaded()) {
    echo "OK\n";
} else {
    echo "Error (Loading configuration)\n";
    die(2);
}
xecho("Executing RPC command '{$rpccommand}': ");
$rpc = new \elbereth\EasyDash($conf->getconfig('rpcuser'), $conf->getconfig('rpcpassword'), 'localhost', $conf->getconfig('rpcport'));
$rpclist = explode(' ', $rpccommand);
$rpcparams = array();
for ($x = 1; $x < count($rpclist); $x++) {
    if (ctype_digit($rpclist[$x])) {
        $rpcparams[] = intval($rpclist[$x]);
    } elseif (is_numeric($rpclist[$x])) {
        $rpcparams[] = floatval($rpclist[$x]);
コード例 #3
0
$command = $argv[2];
if ($argc > 3) {
    $dashd = $argv[3];
} else {
    $dashd = DMN_DASHD_DEFAULT;
}
if ($argc > 4) {
    $extra = $argv[4];
} else {
    $extra = "";
}
if (!is_dir(DMN_PID_PATH . $uname)) {
    xecho("This node don't exist: " . DMN_PID_PATH . $uname . "\n");
    die(2);
}
$conf = new DashConfig($uname);
if (!$conf->isConfigLoaded()) {
    xecho("Error (Config could not be loaded)\n");
    die(7);
}
if ($command == 'start') {
    if (!is_executable($dashd)) {
        xecho("Error ({$dashd} is not an executable file)\n");
        die(8);
    }
    xecho("Starting {$uname}: ");
    if (dmn_start($uname, $conf, $dashd, $extra)) {
        echo "\n";
        die(0);
    } else {
        echo "\n";