OP
Sam Widges
Active Member
From the ps listing above it is not possible to determine which files are being processed by the shells ('ps -w' would have shown this). However, it appears that the script is checking for duplicate sub-shells but only at startup. Would it be better to check for duplicate parents to ensure only one can run at a time?
A simpler alternative might be to create a lock file in /tmp and just exit the parent shell if it exists.
I spent a fair amount of time experimenting with various ps options to make this work both from the command line and cron, but if you can suggest something that should work, I'd love to do it the proper way as the simple ps test I have at the moment is a blatant bodge.
I don't like lock files as they get left around if the box is switched off and the process doesn't exit cleanly. But then again, /tmp is outside of /mod and isn't likely to persist beyond a reboot, so I'll have a look into that.