I have a python script that automatically ends after X amount of runs, at the start of the program it sets the value of restart.txt to 0 using this code.
restart = open("restart.txt", "w")
restart.write("0")
restart.close()
Then at the end of the program it resets the file to 1 so it can restart using inotify, like this.
restart = open("restart.txt", "w")
restart.write("1")
restart.close()
exit //closes program
I want an inotify script or something like that, that when the value of restart.txt changes to 1, to open the program again, a restart.
How would I go about doing that with an inotify script or something similar?