试图在PHP中获取数据库实例的状态
我正在尝试读取RejectionDB的状态,以便使用一个函数来检查并重新启动/启动它(如果它没有运行) 我还对比特币节点执行此操作,以检查节点是否正在运行,如果没有,则运行它 在btc节点示例中,我正在使用:试图在PHP中获取数据库实例的状态,php,linux,rethinkdb,Php,Linux,Rethinkdb,我正在尝试读取RejectionDB的状态,以便使用一个函数来检查并重新启动/启动它(如果它没有运行) 我还对比特币节点执行此操作,以检查节点是否正在运行,如果没有,则运行它 在btc节点示例中,我正在使用: function btcNodeCheck() { // First, check that the Bitcoin node is running.# $node_command = shell_exec('bitcoind -daemon -txindex=1');
function btcNodeCheck() {
// First, check that the Bitcoin node is running.#
$node_command = shell_exec('bitcoind -daemon -txindex=1');
if (contains('Bitcoin Core is probably already running', $node_command) !== false) {
echo "BTC Node turned {Off}, turning on now\n";
sleep(5);
$start_node = shell_exec('bitcoind -daemon -txindex=1');
echo $start_node;
} else {
echo "BTC Node already {On}, doing nothing\n";
}
}
这个很好用。它向我显示节点正在运行的正确输出
我正试图为我的孩子们做同样的事情
我正在使用代码:
function rethinkDBCheck() {
$check_command = shell_exec('/etc/init.d/rethinkdb start');
$outputStatus = $check_command;
echo $outputStatus."\n";
if (contains($check_command, 'has already started') !== false || contains($check_command, 'is already in use') !== false) {
echo "RethinkDB {NOT ACTIVE}\n";
//secureErrorLog("[BAD] Rethink is not yet running => We will run this now");
// Not running, run it at the location
// Sleep for 3 seconds so it shows the data fine
sleep(3);
// Kill any current rethinkdb processes
$stopCurrent = shell_exec('/etc/init.d/rethinkdb stop');
$killCurrent = shell_exec('pkill -9 rethinkdb');
$killCurrent2 = shell_exec('pkill -9 screen');
echo $stopCurrent;
echo $killCurrent;
echo $killCurrent2;
sleep(5);
// Now run the screen for rethinkdb
$startRethink = shell_exec('/etc/init.d/rethinkdb start');
echo $startRethink;
// Restart this function, this time, it should get to the else statement
rethinkDBCheck();
} else {
echo "RethinkDB {ACTIVE}\n";
// We will check all files are running inside our constant loop
runLoop();
}
}
但出于某种原因,它总是给我输出:echo“referencedb{NOT ACTIVE}\n”事实上是这样。$check_命令变量的输出为:实例已启动
我不知道为什么比特币节点命令可以正常工作,但这一个不行
我已经仔细检查了我的stringpos命令,看看这是否是问题所在,但正如我所说,它对btc工作正常
关于它为什么没有向的“REJECTDB{ACTIVE}\n”靠拢的任何想法代码