ad locum local.sh Is the script to test , Voice to text for voice processing
#/usr/bin/env python
import subprocess
class RunCmd(object):
def cmd_run(self, cmd):
self.cmd = cmd
subprocess.call(self.cmd, shell=True)
#Sample usage
a = RunCmd()
for i in range(10):
a.cmd_run('bash local.sh')
#/usr/bin/env python
from re import S
import subprocess
class RunCmd(object):
def cmd_run(self, cmd):
self.cmd = cmd
subprocess.call(self.cmd, shell=True)
#Sample usage
# a = RunCmd()
# for i in range(10):
# a.cmd_run('bash local.sh')
# thread test
import threading
import time
class myThread (threading.Thread):
def __init__(self, threadID, name):
threading.Thread.__init__(self)
self.threadID = threadID
self.name = name
def run(self):
print(" Start thread "+self.name)
a = RunCmd()
for i in range(10):
a.cmd_run('sudo bash local.sh')
print(" End thread "+self.name)
threads = []
num=100
names = locals()
# Create a new thread
for i in range(num):
names['thread{}'.format(str(i))]=myThread(i,'thread-{}'.format(str(i)))
for i in range(num):
names['thread{}'.format(str(i))].start()
for i in range(num):
names['thread{}'.format(str(i))].join()
Here, you can implement multithreading to run together , It's not locked here either