diff --git a/lib/MatterbridgeManager.php b/lib/MatterbridgeManager.php index 42980ee38..970c595f8 100644 --- a/lib/MatterbridgeManager.php +++ b/lib/MatterbridgeManager.php @@ -654,8 +654,9 @@ class MatterbridgeManager { /** * kill the mattermost processes (owned by web server unix user) that do not match with any room + * @param bool $killAll */ - public function killZombieBridges(): void { + public function killZombieBridges(bool $killAll = false): void { // get list of running matterbridge processes $cmd = 'ps -ux | grep "commands/matterbridge" | grep -v grep | awk \'{print $2}\''; exec($cmd, $output, $ret); @@ -669,6 +670,13 @@ class MatterbridgeManager { return; } + if ($killAll) { + foreach ($runningPidList as $runningPid) { + $this->killPid($runningPid); + } + return; + } + // get list of what should be running $expectedPidList = []; $this->manager->forAllRooms(function ($room) use (&$expectedPidList) { @@ -734,7 +742,7 @@ class MatterbridgeManager { }); // finally kill all potential zombie matterbridge processes - $this->killZombieBridges(); + $this->killZombieBridges(true); return true; }