2

I have 5 python files which i need to run on different terminals/consoles. Currently what i'm doing is running each file on its own terminal/console python filename.py.

What i would like is to run one file that will run all the other files in different terminals/consoles.

I haven't tried anything yet. I'm looking for someone to point me in the right direction on what to do.

3
  • Why not put the contents of the 5 files in 5 functions and call them one after another? Commented Jul 4, 2015 at 7:05
  • will that create 5 consoles with each running its file? Commented Jul 4, 2015 at 7:10
  • Nope. But you can write the outputs to a file if you want. Commented Jul 4, 2015 at 17:32

1 Answer 1

1

You could use the screen command, if it is not actually necessary that five different terminals pop up. Write a bash script like this:

#!/bin/bash

screen -dmS "screen-name-1" python filename1.py
screen -dmS "screen-name-2" python filename2.py
screen -dmS "screen-name-2" python filename2.py

Then you can access each screen with e.g.

screen -r screen-name-1

For details, see https://www.rackaid.com/blog/linux-screen-tutorial-and-how-to/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.