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

270
Vistas
How to run several js files at once?

I've created simple tool that I would like to work daily to get new data everyday. I have few js files that I would like to run at once. Instead of manually typing in terminal:

node news.js 
node main.js
node weather.js

Can I automate it somehow to type one command and everything runs automatically when previous file finished task?

Thanks

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Chain the commands:

node news.js && node main.js && node weather.js

By using the && operator you are instructing the system to wait for the end of the first command to run the second. The second command will only run if the first ends with status code 0 and the third will only run if the second also ends with status 0.

Exit status 0 indicates the command finished successfully.

If you don't need the first command to finish successfully you could replace the '&&' with ';' to continue anyway despite error status. If you are on Windows the ; operator doesn't work on command prompt but it does with Powershell.

If you rather want to run them in parallel you could also use:

node news.js & node main.js & node weather.js
about 4 years ago · Juan Pablo Isaza 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