mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Ensure irc fifo-file is shared between dispatcher and core containers (#14647)
* Ensure fifo-file is shared between dispatcher container and core container * Fix config path
This commit is contained in:
@@ -37,7 +37,12 @@ class Irc extends Transport
|
|||||||
|
|
||||||
public function contactIrc($obj, $opts)
|
public function contactIrc($obj, $opts)
|
||||||
{
|
{
|
||||||
$f = Config::get('install_dir') . '/.ircbot.alert';
|
$container_dir = '/data';
|
||||||
|
if (file_exists($container_dir) and posix_getpwuid(fileowner($container_dir))['name'] == 'librenms') {
|
||||||
|
$f = $container_dir . '/.ircbot.alert';
|
||||||
|
} else {
|
||||||
|
$f = Config::get('install_dir') . '/.ircbot.alert';
|
||||||
|
}
|
||||||
if (file_exists($f) && filetype($f) == 'fifo') {
|
if (file_exists($f) && filetype($f) == 'fifo') {
|
||||||
$f = fopen($f, 'w+');
|
$f = fopen($f, 'w+');
|
||||||
$r = fwrite($f, json_encode($obj) . "\n");
|
$r = fwrite($f, json_encode($obj) . "\n");
|
||||||
|
@@ -218,7 +218,12 @@ class IRCBot
|
|||||||
|
|
||||||
private function connectAlert()
|
private function connectAlert()
|
||||||
{
|
{
|
||||||
$f = $this->config['install_dir'] . '/.ircbot.alert';
|
$container_dir = '/data';
|
||||||
|
if (file_exists($container_dir) and posix_getpwuid(fileowner($container_dir))['name'] == 'librenms') {
|
||||||
|
$f = $container_dir . '/.ircbot.alert';
|
||||||
|
} else {
|
||||||
|
$f = $this->config['install_dir'] . '/.ircbot.alert';
|
||||||
|
}
|
||||||
if ((file_exists($f) && filetype($f) != 'fifo' && ! unlink($f)) || (! file_exists($f) && ! shell_exec("mkfifo $f && echo 1"))) {
|
if ((file_exists($f) && filetype($f) != 'fifo' && ! unlink($f)) || (! file_exists($f) && ! shell_exec("mkfifo $f && echo 1"))) {
|
||||||
$this->log('Error - Cannot create Alert-File');
|
$this->log('Error - Cannot create Alert-File');
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user