0

I use python multi threading to execulate a shell script, but for some reason, this shell script can't execulate by multi thread, I want make this script avoid multi thread for foolproof, Is any way can do?

thanks!

Karl Lin
  • 307
  • 4
  • 16
  • 1
    https://stackoverflow.com/a/37303133/2836621 – Mark Setchell Aug 23 '17 at 07:00
  • *this shell script can't execulate by multi thread* - what happened? Does it give an error message, or what? Please define "can't execute". How are you executing the script from python? In python, are you aware of the GIL? http://www.dabeaz.com/python/UnderstandingGIL.pdf – cdarke Aug 23 '17 at 07:05

1 Answers1

1

Use a mutex. Say, create in the script check if a file is created (e.g. in /temp). If file exists, exit. If not, create it and do useful actions. In the end delete the file.

dimirsen Z
  • 873
  • 13
  • 16