I've got a Counter-Strike server that I run (all work and no play is no fun at all!) I have a great piece of perl code that parses the logs and fills a database full of stats (very cool. Psychostats by Stormtrooper). Problem is, usually you just set up a cron job to run the script every 10 minutes or so, but I'm not running the server continuously. I'd like to write a little script, daemon really, that'll check and see if the CS server is up periodically and run the stats script if it is.
What's the proper way to write a daemon? Using Proc::Daemon, one can spawn the daemon process, but what about the meat of the program?
I was considering using something like this:
... #do stuff here
Is there a better/cleaner way? Thanks!