|
|
- <?php
-
- namespace App\Commands;
-
- use Illuminate\Console\Scheduling\Schedule;
- use LaravelZero\Framework\Commands\Command;
-
- /**
- *
- *
- *
- */
- class LetsEncryptInstallCommand extends Command
- {
- /**
- * The signature of the command.
- *
- * @var string
- */
- protected $signature = 'lets-encrypt:install';
-
- /**
- * The description of the command.
- *
- * @var string
- */
- protected $description = 'Install LetsEncrypt for nginx';
-
- /**
- * Execute the console command.
- *
- * @return mixed
- */
- public function handle()
- {
- $this->info('LetsEncrypt installing...');
-
- exec('apt update 2>&1');
- exec('apt-get install software-properties-common 2>&1');
- exec('add-apt-repository universe 2>&1');
- exec('add-apt-repository ppa:certbot/certbot 2>&1');
- exec('apt-get update 2>&1');
- exec('apt-get install certbot python3-certbot-nginx 2>&1');
-
- if (Install::isReady('certbot')) {
- $this->info('LetsEncrypt installing...Success! \o/');
- } else {
- $this->error("Failed! Please check log-file!");
- }
- }
- }
|