mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 15:44:45 +02:00
Improve "no interaction" mode for queue worker service command (#270)
This commit is contained in:
parent
e715e92f9d
commit
422fc102c9
@ -14,15 +14,17 @@ class QueueWorkerServiceCommand extends Command
|
||||
{--service-name= : Name of the queue worker service.}
|
||||
{--user= : The user that PHP runs under.}
|
||||
{--group= : The group that PHP runs under.}
|
||||
{--use-redis : Whether redis is used.}';
|
||||
{--use-redis : Whether redis is used.}
|
||||
{--overwrite : Force overwrite if the service file already exists.}';
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
$serviceName = $this->option('service-name') ?? $this->ask('Service name', 'pelican-queue');
|
||||
$path = '/etc/systemd/system/' . $serviceName . '.service';
|
||||
|
||||
if ($this->input->isInteractive()) {
|
||||
if (file_exists($path) && !$this->confirm('The service file already exists. Do you want to overwrite it?')) {
|
||||
if (file_exists($path) && !$this->option('overwrite') && !$this->confirm('The service file already exists. Do you want to overwrite it?')) {
|
||||
$this->line('Creation of queue worker service file aborted.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -30,12 +32,6 @@ class QueueWorkerServiceCommand extends Command
|
||||
$group = $this->option('group') ?? $this->ask('Group', 'www-data');
|
||||
|
||||
$afterRedis = $this->option('use-redis') ? '\nAfter=redis-server.service' : '';
|
||||
} else {
|
||||
$user = 'www-data';
|
||||
$group = 'www-data';
|
||||
|
||||
$afterRedis = '';
|
||||
}
|
||||
|
||||
$basePath = base_path();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user