Yes update locking is the right way https://docs.resin.io/runtime/update-locking/ but two comments:
First, don’t just create the file, it’s not correct that way, it has to be a lockfile. Check the lockfile
command https://linux.die.net/man/1/lockfile if using linux command line tools, or there are lockfile routines in other languages if you need to. (We are improving on our docs as well, working on making it more user friendly, so please share any feedback you might have)
Second, how does your application work, is it always uninterruptable? Because normally you could wrap the part of your code that is uninterruptable between update locking/unlocking (imagine an ATM: it would update lock while someone’s using it, and unlock when they’ve finished). Otherwise I think cron can be a possible way, just might be prone to corner cases.
Please also note, that update locking also blocks device restart or shutdown from the dashboard (for the same reason of keeping the device uninterrupted, in which sense update lock
is a bit of a misnomer, unfortunately, it rather means “app restart lock” in practice).
What do you think?