mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 14:36:17 +00:00
fix create queue with root user (#409)
* fix create queue with root user * fix * fix queues for root user
This commit is contained in:
@ -23,5 +23,5 @@ public function stop(int $id, ?int $siteId = null): void;
|
||||
|
||||
public function start(int $id, ?int $siteId = null): void;
|
||||
|
||||
public function getLogs(string $logPath): string;
|
||||
public function getLogs(string $user, string $logPath): string;
|
||||
}
|
||||
|
@ -40,18 +40,22 @@ public function create(
|
||||
string $logFile,
|
||||
?int $siteId = null
|
||||
): void {
|
||||
$this->service->server->ssh()->write(
|
||||
"/etc/supervisor/conf.d/$id.conf",
|
||||
$this->generateConfigFile(
|
||||
$id,
|
||||
$command,
|
||||
$user,
|
||||
$autoStart,
|
||||
$autoRestart,
|
||||
$numprocs,
|
||||
$logFile
|
||||
),
|
||||
true
|
||||
);
|
||||
$this->service->server->ssh($user)->exec(
|
||||
$this->getScript('supervisor/create-worker.sh', [
|
||||
'id' => $id,
|
||||
'config' => $this->generateConfigFile(
|
||||
$id,
|
||||
$command,
|
||||
$user,
|
||||
$autoStart,
|
||||
$autoRestart,
|
||||
$numprocs,
|
||||
$logFile
|
||||
),
|
||||
]),
|
||||
'create-worker',
|
||||
$siteId
|
||||
@ -117,9 +121,9 @@ public function start(int $id, ?int $siteId = null): void
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function getLogs(string $logPath): string
|
||||
public function getLogs(string $user, string $logPath): string
|
||||
{
|
||||
return $this->service->server->ssh()->exec(
|
||||
return $this->service->server->ssh($user)->exec(
|
||||
"tail -100 $logPath"
|
||||
);
|
||||
}
|
||||
|
@ -4,10 +4,6 @@ mkdir -p ~/.logs/workers
|
||||
|
||||
touch ~/.logs/workers/__id__.log
|
||||
|
||||
if ! echo '__config__' | sudo tee /etc/supervisor/conf.d/__id__.conf; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
||||
if ! sudo supervisorctl reread; then
|
||||
echo 'VITO_SSH_ERROR' && exit 1
|
||||
fi
|
||||
|
Reference in New Issue
Block a user