video-setup: kill existing processes

pull/460/head
Varun Patil 2023-02-24 09:12:23 -08:00
parent b30bd9bd38
commit cf1109e5fd
2 changed files with 15 additions and 0 deletions

View File

@ -130,6 +130,8 @@ class VideoSetup extends Command
$this->config->setSystemValue('memories.no_transcode', true);
$output->writeln('<error>Transcoding and HLS are now disabled</error>');
$this->killGoVod($output, $goVodPath);
return 0;
}
@ -157,6 +159,8 @@ class VideoSetup extends Command
$this->config->setSystemValue('memories.qsv', false);
}
$this->killGoVod($output, $goVodPath);
return 0;
}
@ -183,4 +187,10 @@ class VideoSetup extends Command
return 0;
}
protected function killGoVod(OutputInterface $output, string $path): void
{
$output->writeln("\nKilling any existing go-vod processes");
\OCA\Memories\Util::pkill($path);
}
}

View File

@ -157,6 +157,11 @@ class Util
*/
public static function pkill(string $name): void
{
// don't kill everything
if (empty($name)) {
return;
}
// get pids using ps as array
$pids = shell_exec("ps -ef | grep {$name} | grep -v grep | awk '{print $2}'");
if (null === $pids || empty($pids)) {