Update tmux start/stop commands, add script to clone, compile and install latest tmux from source

This commit is contained in:
DariusIII
2018-09-05 11:16:22 +02:00
parent e2032dde6d
commit e2b016a2c1
8 changed files with 56 additions and 441 deletions
+7 -32
View File
@@ -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);