Yes, I'd considered using a database, but I wanted to avoid it if possible. Plus it's too easy :)
I would imagine the I/O overhead for the files (and shell overhead for execution) would be more than the DB overhead (plus I'm already using a DB, so the connection overhead is already accounted for).
There are certain things in memory of that particular process (command line parameters, time of execution, etc.) that require me to keep the process around (sleeping) - I could write all necessary things out, but... that sounds too complicated and less maintainable... so I'm thinking:
- Create a queue file w/ PID ($$.queue)
- Get oldest queue file (ls -rt | head -1)
- Check to see if that process is running (kill 0 $file)
- If not running, remove $file and repeat step 2
- If running, is $file == $$?
- If not, sleep for a while, then go to step 3.
How does that sound?
--------------
"But what of all those sweet words you spoke in private?"
"Oh that's just what we call pillow talk, baby, that's all."