mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 17:01:16 +00:00
Update tmux start/stop commands, add script to clone, compile and install latest tmux from source
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Settings;
|
||||
use Blacklight\Tmux;
|
||||
use Illuminate\Console\Command;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
@@ -20,18 +21,7 @@ class TmuxUIStop extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Stop the processing of tmux scripts. This is functionally equivalent to unsetting the
|
||||
\'tmux running\' setting in admin. Usage: tmux-ui:stop false (does not kill tmux session), while using true will kill current tmux session';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
protected $description = 'Stop the processing of tmux scripts.';
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
@@ -39,31 +29,16 @@ class TmuxUIStop extends Command
|
||||
public function handle()
|
||||
{
|
||||
if ($this->argument('type') !== null) {
|
||||
$process = new Process('php misc/update/tmux/stop.php');
|
||||
$process->setTimeout(600);
|
||||
$process->run(
|
||||
function ($type, $buffer) {
|
||||
if (Process::ERR === $type) {
|
||||
echo 'ERR > '.$buffer;
|
||||
} else {
|
||||
echo $buffer;
|
||||
}
|
||||
}
|
||||
);
|
||||
(new Tmux())->stopIfRunning();
|
||||
|
||||
if ($this->argument('type') === 'true') {
|
||||
$sessionName = Settings::settingValue('site.tmux.tmux_session');
|
||||
$tmuxSession = new Process('tmux kill-session -t '.$sessionName);
|
||||
$this->info('Killing active tmux session: '.$sessionName);
|
||||
$tmuxSession->run(
|
||||
function ($type, $buffer) {
|
||||
if (Process::ERR === $type) {
|
||||
echo 'ERR > '.$buffer;
|
||||
} else {
|
||||
echo $buffer;
|
||||
}
|
||||
}
|
||||
);
|
||||
$tmuxSession->run();
|
||||
if ($tmuxSession->isSuccessful()) {
|
||||
$this->info('Tmux session killed successfully');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->error($this->description);
|
||||
|
||||
Reference in New Issue
Block a user