in reply to One process at a time

Follow the above FLOCK advice of merlyn for how to keep two instances from running at once.

If you're on Linux, consider putting a script to start/kill your daemon in /etc/rc.d/init.d.

Then you can say

service your_service_name_here start service your_service_name_here stop

Follow the pattern of the other items in /etc/rc.d/init.d and use chkconfig to install your script into the proper run levels. Then it will start when the system boots and stop when it shutsdown.

To make your script a daemon in the first place you might try Proc::Daemon.

Phil