OpenSource CLI-App to install and handle stuff related to Web-Server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.2 KiB

4 years ago
  1. <?php
  2. namespace App\Commands;
  3. use Illuminate\Console\Scheduling\Schedule;
  4. use LaravelZero\Framework\Commands\Command;
  5. use Illuminate\Support\Facades\File;
  6. use App\Facades\Install;
  7. use Log;
  8. class NginxInstallCommand extends Command
  9. {
  10. /**
  11. * The signature of the command.
  12. *
  13. * @var string
  14. */
  15. protected $signature = 'nginx:install';
  16. /**
  17. * The description of the command.
  18. *
  19. * @var string
  20. */
  21. protected $description = 'Install Nginx';
  22. /**
  23. * Execute the console command.
  24. *
  25. * @return mixed
  26. */
  27. public function handle()
  28. {
  29. //$option = $this->menu('Install')
  30. // ->addOption('nginx', 'Nginx')
  31. // ->open();
  32. //File::put('/etc/kkk', '/etc/kkk');
  33. //$workers = exec('echo $(grep ^processor /proc/cpuinfo | wc -l)');
  34. //$
  35. //$
  36. $this->info('Nginx install...');
  37. exec('apt update 2>&1');
  38. exec('apt install -y nginx 2>&1');
  39. if (Install::isReady('nginx')) {
  40. // get status of nginx
  41. exec('nginx -v 2>&1', $output);
  42. $status = "$output[0] installed";
  43. $this->info($status);
  44. Log::info($status);
  45. }
  46. }
  47. }