refactoring (#116)

- refactoring architecture
- fix incomplete ssh logs
- code editor for scripts in the app
- remove Jobs and SSHCommands
This commit is contained in:
Saeed Vaziry
2024-03-14 20:03:43 +01:00
committed by GitHub
parent cee4a70c3c
commit 428140b931
472 changed files with 24110 additions and 8159 deletions

27
app/SSH/Cron/Cron.php Normal file
View File

@ -0,0 +1,27 @@
<?php
namespace App\SSH\Cron;
use App\Models\Server;
class Cron
{
public function __construct(protected Server $server)
{
}
public function update(string $user, string $cron): void
{
$command = <<<EOD
if ! echo '$cron' | sudo -u $user crontab -; then
echo 'VITO_SSH_ERROR' && exit 1
fi
if ! sudo -u $user crontab -l; then
echo 'VITO_SSH_ERROR' && exit 1
fi
EOD;
$this->server->ssh()->exec($command);
}
}