Comment 2 for bug 1933984

Revision history for this message
Jason Stephenson (jstephenson) wrote :

I have branches ready that I have tested with production data over the past few days. The branches can be installed independently of each other, but to get the full benefit, both OpenSRF and Evergreen should be updated at the same time.

The OpenSRF branch is https://git.evergreen-ils.org/?p=working/OpenSRF.git;a=shortlog;h=refs/heads/user/dyrcona/lp1933984-perl-utils-daemonize-improvements

The OpenSRF branch improves the behavior of the daemonize function by

1. Setting the umask to a known, useful, value: 022
2. Closing all open file descriptors.
3. Opening STDIN, STDOUT, and STDERR to /dev/null.

It also adds a hard dependency on the BSD::Resource Perl module. This module is presently required for mod_perl, but I added it as an explicit dependency in case the mod_perl dependencies ever change. The dependency change is in a separate commit from the code changes in case it is deemed unnecessary.

The Evergreen branch is https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/dyrcona/lp1933984-teach-clark-about-syslog

The Evergreen changes affect only the clark-kent.pl program. Most messages will be logged to syslog rather than to STDERR/STDOUT. It was neccessary to log all warnings during reporting to syslog because the reporting child processes daemonize themselves regardless of whether the main process is started as a daemon or not. (I consider changing that behavior to be a separate bug.)

Only those issues which occur before the main procces would daemonize itself are sent to the STDERR stream of the console. These generally affect process startup. Any fatal DBI errors and a failure to create the lock file in the main process are logged to both syslog and to STDERR. The latter do not go to the console when the main process is daemonized.