What is the currently accepted "best" way to create a single instance application on Linux? There are a couple of requirements and constraints:
- It's a Raspberry Pi, so the more lightweight, the better.
- I'm running Raspbian 4.1.18.
- I have full control over everything that runs, and everyone that has physical access to the machine. So I don't need to be able to solve situations where someone, for example, renames a locked file deliberately.
- If another instance of my app is running, I want the new instance to shut down. It doesn't need to pass anything to the old instance.
- I'd prefer if it was C89 and gcc compatible. But I suspect the code will be short enough to fix even if it's not.
Thanks in advance!