繁体   English   中英

我可以使用bash脚本运行多个Python输入吗?

[英]Can I run multiple Python inputs using a bash script?

许多人认为,此代码应同时运行。 所有这些操作都是运行文件,但它总是留下一个随机文件等待接收输入。

#!/bin/bash

echo "SCRIPT START"
echo "user = ${USER}"
cd
service nginx start
cd /var/app/scripts
python script_reset.py -1
python script_print_ticket.py 18 &
python script_reset.py 23 &
python script_balcony.py 5 1 &
python script_balcony.py 6 2 &
python script_balcony.py 13 3 &
python script_balcony.py 19 4 &
python script_balcony.py 26 5 &

在每个python文件中,我都使用GPIO输入(来自Raspberry Pi的引脚),但我认为这无关紧要,无论如何。

while True:
    #Read button input status
    btn_input_state = GPIO.input(button)

谢谢,

卢卡斯

为什么不在一个 .py运行所有这些?
例如:

import script_reset, script_print_ticket, script_balcony
if __name__ == '__main__':
    script_reset.main(-1)
    while True:
        script_print_ticket.main(18)
        script_reset.main(23)
        for i, p in enumerate([5, 6, 13, 19, 26], 1):
            script_balcony.main(p,i)
        timer.sleep(1)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM