i've got a cron job set to call this java app every minute. this app looks in a directory for some files, if it finds the files it's looking for then it does some processing on them. if it doesn't find the files, it quits.
i need a way to prevent other java processes from interferring with this, uh, process. so the initial java app looks to see if a lock file exists in the search directory. if it doesn't then it creates one and stores its PID in it.
why? because if another java process comes in and sees the lock file, it will get the stored PID and look to see if it exists in /proc if it does, it knows to get out, if it doesn't find the PID in /proc, then it knows that it can ignore the lock file, that is, the lockfile is bad (leftover from a process that is no longer running.)
does this give you a reasonable idea what i'm trying to accomplish?