mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 14:36:17 +00:00
Feature/add remote server logs (#159)
This commit is contained in:
@ -108,12 +108,18 @@ public function editFile(string $path, ?string $content = null): void
|
||||
);
|
||||
}
|
||||
|
||||
public function readFile(string $path): string
|
||||
public function readFile(string $path, ?int $lastLines = null): string
|
||||
{
|
||||
$params = [
|
||||
'path' => $path,
|
||||
];
|
||||
|
||||
if ($lastLines !== null) {
|
||||
$params['lines'] = $lastLines;
|
||||
}
|
||||
|
||||
return $this->server->ssh()->exec(
|
||||
$this->getScript('read-file.sh', [
|
||||
'path' => $path,
|
||||
])
|
||||
$this->getScript('read-file.sh', $params)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1 +1,7 @@
|
||||
[ -f __path__ ] && cat __path__
|
||||
if [ -f __path__ ]; then
|
||||
if [ -n __lines__ ]; then
|
||||
sudo tail -n __lines__ __path__
|
||||
else
|
||||
sudo cat __path__
|
||||
fi
|
||||
fi
|
||||
|
Reference in New Issue
Block a user