Hello,
I am deploying a little service to an UNIX(AIX) system. I want to check if there is no active instance of that service running when starting it. How reliable is to implement that check like this?
- Try to acquire a lock on a file (w/
FileChannel
) - If succeeds, keep lock and continue execution
- If fails, exit and refuse to run the main body
I am aware of software like the Tanuki wrapper, however, I'm longing for a simpler(maybe not portable) solution.
EDIT: Regarding PIDFILE(s): I want to avoid using them if possible, as I don't have administrative rights on the machine, neither knowledge in AIX's shell programming.