[英]How to run different python files in different terminals (each having different PIDs) from a single bash script?
I have 3 python files stored in different folders. 我有3个python文件存储在不同的文件夹中。 I need these files to run in different terminals.
我需要这些文件在不同的终端上运行。 I have also tried the solution given here but this is not what I am trying to achieve.
我也尝试过这里给出的解决方案,但这不是我要达到的目的。 This is my code so far:
到目前为止,这是我的代码:
RPI_GATEWAY_LAUNCHER.py
RPI_GATEWAY_LAUNCHER.py
#!/bin/sh
###### STARTING UP NRF MODULE #####
sleep 2
cd Desktop/RPI_GATEWAY/NRF24L01
python NRF_MQTT.py
sleep 5
###################################
#### STARTING UP TEST MODULE 1 ####
cd Desktop/RPI_GATEWAY/TEST
python TEST_PUB_1.py
sleep 2
###################################
#### STARTING UP TEST MODULE 2 ####
cd Desktop/RPI_GATEWAY/TEST
python TEST_PUB_2.py
sleep 2
###################################
you can try with: 您可以尝试:
#!/bin/sh
###### STARTING UP NRF MODULE #####
sleep 2
pushd Desktop/RPI_GATEWAY/NRF24L01
terminal -e python NRF_MQTT.py
pwd
sleep 5
###################################
#### STARTING UP TEST MODULE 1 ####
pushd Desktop/RPI_GATEWAY/TEST
terminal -e python TEST_PUB_1.py
sleep 2
pwd
###################################
#### STARTING UP TEST MODULE 2 ####
pushd Desktop/RPI_GATEWAY/TEST
terminal -e python TEST_PUB_2.py
sleep 2
pwd
###################################
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.