Hitesh Roy
Hitesh Roy

Reputation: 337

want to run multiple commands with single script

I am creating a single script for setup and running whole Django project.

I mentioned three commands in script. which executed one on one....

Commands:

subprocess.run(args=['nohup', 'airflow', 'scheduler']) 
subprocess.run(args=['nohup', 'airflow', 'webserver'])
subprocess.run(args=['python', 'manage.py', 'runserver'])

I used nohup for airflow webserver and scheduler to runs on background

All three command runs one by one as per requirement but the problem is when airflow scheduler runs the script stops at point.

Is there any command or something I can used to run all the commands in single script with stop points.

Upvotes: 2

Views: 791

Answers (1)

Hitesh Roy
Hitesh Roy

Reputation: 337

Solve the problem with subprocess Popen

subprocess.Popen(args=['nohup', 'airflow', 'scheduler']) 
subprocess.Popen(args=['nohup', 'airflow', 'webserver'])
subprocess.Popen(args=['python', 'manage.py', 'runserver'])

This runs all the command one on one in same terminal

Upvotes: 2

Related Questions