

Flock does this functionality, the deal is that it waited for the long-running process to end so it wouldn’t release the lock after the script was done. Adding a line manually releasing it fixed it.
It’s an auto-update script, you don’t wanna start a new update while one is underway.
sorry fLock it my phone doesn’t like it and don’t really know what the f stands for. but flock is a Linux command that let’s you manage simple concurrency issues https://www.man7.org/linux/man-pages/man1/flock.1.html