Initial attempt at starting daemon in background

This commit is contained in:
Paul Kirby 2020-02-17 20:02:27 -06:00
parent 94c52bb5eb
commit 920591a171
2 changed files with 14 additions and 5 deletions

View file

@ -38,8 +38,9 @@ class LBRY_Daemon
$this->notice = new LBRY_Admin_Notice();
$this->daemon_running = $this->test_daemon();
if (!$this->daemon_running && !$this->start_daemon()) {
$this->notice->set_notice('error', 'Cannot connect to the LBRY Daemon. Click <a href="' . admin_url('admin.php?page=lbrypress-help') . '">HERE</a> for help.');
if (!$this->daemon_running) {
$this->start_daemon();
$this->notice->set_notice('error', 'Cannot connect to the LBRY Daemon. Attempting to start server. <br /> If you are still having troubles, click <a href="' . admin_url('admin.php?page=lbrypress-help') . '">HERE</a> for help.');
}
}
@ -60,11 +61,19 @@ class LBRY_Daemon
/**
* Attempts to start the daemon
* @return bool True on success
*/
private function start_daemon()
{
return false;
$response = popen(ABSPATH . '/lbrynet start', "w");
error_log(print_r($response));
}
/**
* Attempts to start the daemon
*/
private function stop_daemon()
{
exec(ABSPATH . '/lbrynet stop &');
}
/**

View file

@ -9,7 +9,7 @@
<h2>Usage</h2>
<p>By default, `lbrynet` will provide a JSON-RPC server at `http://localhost:5279`. This is the address our plugin will be expecting to use.</p>
<p>By default, <code>lbrynet</code> will provide a JSON-RPC server at <code>http://localhost:5279</code>. This is the address our plugin will be expecting to use.</p>
<p>If curious, The full API is documented <a href="https://lbry.tech/api/sdk" target="_blank">here</a></p>
<p><a href="https://github.com/lbryio/lbry-sdk/blob/master/README.md" target="_blank">SDK Github</a></p>