« A Number of Alternatives Exist in Ink Jet Printer Market | Main | RSS-Search Adds New Features »

Enhancing a Perl-UNIX Daemon: Integration with System Logs

Dave Aiello wrote, "Last week, I talked about the minimal changes that are required to daemonize a Perl program originally designed to run as a UNIX cron job. I have to admit that the approach I suggested was too simplistic for my application."

"I took down the new daemon within six hours because it was silently dying-- something a UNIX daemon obviously can't be allowed to do. And, simply sending standard output and standard error to /dev/null, as the WebReference tutorial suggested, didn't help me understand what the problem was."

"This time, I went to my bookshelf for guidance, and picked up Lincoln Stein's excellent
Network Programming with Perl
, published by Addison-Wesley. There is a lot of information in this book that is applicable to this problem. I found Chapter 14, Bulletproofing Servers, to be particularly useful. It talks about using Sys::Syslog to write status messages to the system error log, and to overload warn() and die() so that they are logged in the same fashion."

"The chapter also takes a simple server that had been written in previous examples in the book and adds these features to it. When making significant changes to programs like this, it's always useful to be able to compare the before and after states of an example."

"I am going to try to implement the recommended changes in my own daemon today, and I will report on the value of these changes in a future article."

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About CTDATA

CTDATA Venutures (CTDATA) develops Internet and Intranet applications for corporations and non profit organizations. Our services include:

  • Consulting services for Movable Type and TypePad-based publishing systems (visit our Weblog Improvement website for more information),
  • Financial services business process consulting,
  • Content management system and knowledge management system consulting,
  • Apache web server engineering and hosting,
  • MySQL, Sybase, and Microsoft SQL Server architecture and development,
  • SOAP, REST, and XML-RPC system architecture and programming, including Amazon Web Services and
  • Weblog publishing.
For more information, contact Dave Aiello by email at dave [at] daveaiello.com or call him at +1-267-352-4420.
Copyright © 1995-2010, CTDATA Ventures. All Rights Reserved.
Powered by
Movable Type 4.25