fix create queue with root user (#409)

* fix create queue with root user

* fix

* fix queues for root user
This commit is contained in:
Saeed Vaziry
2024-12-30 02:33:00 -08:00
committed by GitHub
parent dfdd50beb7
commit 8b86ff23c9
9 changed files with 68 additions and 35 deletions

View File

@ -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;
}

View File

@ -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"
);
}

View File

@ -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