Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

2.3K
Vistas
How can I run background tasks in Gitlab CICD?

How can I run a service-based command after the build process in gitlab-ci.yml?

For example, i'd like to run:

php artisan queue:listen --timeout=0 &

The issue is the build runs perpetually and does not finish as it waits for the results of this command (even though this command never finishes).

Is there anyway I can run it as a background task? I tried nohup with no luck.

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

As mentioned here:

Process started with Runner, even if you add nohup and & at the end, is marked with process group ID.
When the job is finished, the Runner is sending a kill signal to the whole process group.
So any process started directly from CI job will be terminated at job end.

Using a systenter code hereemd service (as in this same page) remains an option, if you control the target server.

over 4 years ago · Santiago Trujillo Denunciar

0

With VonC's help - this is the approach I took.

I use Alpine Linux so slightly different to the link he provided, but same approach.

I created a file in /etc/init.d and gave it chmod +x permissions.

With the following contents:

#!/sbin/openrc-run

command="php /var/www/artisan queue:listen"
command_args="--timeout=0"
command_background=true
pidfile="/run/${RC_SVCNAME}.pid"

I then ran it with rc-service laravel-queue start within the gitlab-ci configuration file.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda