Update source into github
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Http\Services\WinRMClient;
|
||||
use Exception;
|
||||
use Illuminate\Console\Command;
|
||||
use phpseclib3\Net\SSH2;
|
||||
|
||||
class Test extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'app:test';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
try {
|
||||
// $ssh = new SSH2('103.42.58.37', 22, 10);
|
||||
// if (!$ssh->login('root', 'TGS@123')) {
|
||||
// exit('Login Failed');
|
||||
// }
|
||||
$username = "administrator";
|
||||
$password = 'TGS@123';
|
||||
$client = new WinRMClient('10.10.10.173', 'administrator', 'Thegioiso@123**$$8899TgTk2');
|
||||
// $output = $client->execute_command("net user \"$username\" \"$password\"");
|
||||
$output = $client->execute_command("dir c:\\");
|
||||
echo $output;
|
||||
// $client = new WinRMClient('192.168.1.100', 'username', 'password');
|
||||
// Rename HostName
|
||||
// echo $ssh->exec("hostnamectl set-hostname NguyenKhoi_Dev");
|
||||
|
||||
// Cập nhật IP tĩnh
|
||||
// $ssh->exec("nmcli con mod ens192 ipv4.address 103.42.58.37/24;");
|
||||
// $ssh->exec("nmcli con mod ens192 ipv4.gateway 103.42.58.1;");
|
||||
|
||||
// Resize disk Centos 7
|
||||
// $ssh->exec("sudo pvcreate /dev/sda2;");
|
||||
// $ssh->exec("sudo vgextend /dev/centos /dev/sda2;");
|
||||
// $ssh->exec("sudo lvextend /dev/centos/root /dev/sda2");
|
||||
// $ssh->exec("xfs_growfs /dev/centos/root");
|
||||
|
||||
// Resize disk Centos 8
|
||||
// $ssh->exec("sudo growpart /dev/sda 3");
|
||||
// $ssh->exec("sudo pvresize /dev/sda3");
|
||||
// $ssh->exec("sudo lvresize -l+100%FREE --resizefs /dev/mapper/ubuntu--vg-ubuntu--lv");
|
||||
|
||||
// 'growpart /dev/sda 3; pvresize /dev/sda3; lvresize -l+100%FREE --resizefs /dev/mapper/ubuntu--vg-ubuntu--lv;
|
||||
|
||||
// Change Pasword
|
||||
// $ssh->exec("echo \"root:TGS@123\" | chpasswd");
|
||||
|
||||
// echo $ssh->exec("sudo tee /sys/class/block/sda/device/rescan");
|
||||
// echo $ssh->exec("lsblk");
|
||||
} catch (Exception $exception) {
|
||||
echo $exception->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user