D
D
darke3v2013-12-17 17:07:13
linux
darke3v, 2013-12-17 17:07:13

Limit on the number of running scripts?

Good day, I use subprocess to run the script

subprocess.Popen("path/python.py %s &" % stats.id,
                             shell=True, stdout=subprocess.PIPE)

I would like to introduce a restriction so that when it is already running, it would be impossible to launch the second one.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vlad Zhivotnev, 2013-12-17
@inkvizitor68sl

docs.python.org/2/library/fcntl.html - flock
Well, or just run under the console flock.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question