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.

55 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 LetsEncryptInstallCommand extends Command
  9. {
  10. /**
  11. * The signature of the command.
  12. *
  13. * @var string
  14. */
  15. protected $signature = 'lets-encrypt:install';
  16. /**
  17. * The description of the command.
  18. *
  19. * @var string
  20. */
  21. protected $description = 'Install LetsEncrypt';
  22. /**
  23. * Execute the console command.
  24. *
  25. * @return mixed
  26. */
  27. public function handle()
  28. {
  29. $this->info('LetsEncrypt install...');
  30. exec('apt update 2>&1');
  31. exec('apt-get install software-properties-common 2>&1');
  32. exec('add-apt-repository universe 2>&1');
  33. exec('add-apt-repository ppa:certbot/certbot 2>&1');
  34. exec('apt-get update 2>&1');
  35. exec('apt-get install certbot python3-certbot-nginx 2>&1');
  36. if (Install::isReady('nginx')) {
  37. // get status of nginx
  38. exec('nginx -v 2>&1', $output);
  39. $status = "$output[0] installed";
  40. $this->info($status);
  41. Log::info($status);
  42. }
  43. }
  44. }