mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-21 02:41:36 +00:00
- refactoring architecture - fix incomplete ssh logs - code editor for scripts in the app - remove Jobs and SSHCommands
24 lines
444 B
PHP
24 lines
444 B
PHP
<?php
|
|
|
|
namespace App\Actions\Server;
|
|
|
|
use App\Enums\ServerStatus;
|
|
use App\Models\Server;
|
|
use Throwable;
|
|
|
|
class RebootServer
|
|
{
|
|
public function reboot(Server $server): Server
|
|
{
|
|
try {
|
|
$server->os()->reboot();
|
|
$server->status = ServerStatus::DISCONNECTED;
|
|
$server->save();
|
|
} catch (Throwable) {
|
|
$server = $server->checkConnection();
|
|
}
|
|
|
|
return $server;
|
|
}
|
|
}
|