video-setup: kill existing processes
parent
b30bd9bd38
commit
cf1109e5fd
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue