I got a Schedule which has 3 Actions. Each Action executes an Action Group which is in effect a shell script. I run this schedule every 2 seconds. The scripts helps me getting the state of certain things like my Mac monitors, my Zoom connection and my computer's bluetooth. The scripts work fine 99% of the time but for some weird reason when Parallels does some heavy duty disk work (like Windows 10 updates or disk reclaim) sometimes this will cause some of these scripts to get locked. This wouldn't be a big issue if it wasn't by the fact that I run them every 2 secs. This means that very quickly a lot of processes start to accumulate in the background and eventually the Mac becomes unresponsive. So how can I prevent this situation? Obviously I could try to change these scripts into actual programs which hook into MacOS APIs so that I can run them as a deamon and rather than polling every 2 seconds I can develop something that updates Indigo variables when needed. But I think it will be an overkill and not worth the trouble. The scripts as they are work fine, if I can add some logic to prevent them from executing again if the previous execution is not finished that will do the trick I think. I thought of creating some semaphore files so I can create a file when the script starts and delete it after it's done but I will be writting to the disk all the time so not the best idea when using SSDs. What about using Indigo variables? Are these stored in memory only? Otherwise how can I control that my Action Group scripts don't run again if they are stuck in the previous execution without writing to disk?
Thanks!