mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 05:56:16 +00:00
use blade as conmmands template (#444)
* use blade as conmmands template * fix lint * fix ssl
This commit is contained in:
@ -2,26 +2,24 @@
|
||||
|
||||
namespace App\SSH\Cron;
|
||||
|
||||
use App\Exceptions\SSHError;
|
||||
use App\Models\Server;
|
||||
|
||||
class Cron
|
||||
{
|
||||
public function __construct(protected Server $server) {}
|
||||
|
||||
/**
|
||||
* @throws SSHError
|
||||
*/
|
||||
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
|
||||
|
||||
echo 'cron updated!'
|
||||
EOD;
|
||||
|
||||
$this->server->ssh()->exec($command, 'update-cron');
|
||||
$this->server->ssh()->exec(
|
||||
view('ssh.cron.update', [
|
||||
'cron' => $cron,
|
||||
'user' => $user,
|
||||
]),
|
||||
'update-cron'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user