----- Original Message ----- From: "Mike Wexler" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, December 25, 2002 6:43 PM Subject: Re: SOLVED! (was: Re: What is wrong with this query?)
> This is getting a little bit away from mysql You are right, Mike, and, after this post, I will take the Perl argument off-list. Just FYI, for those who thought my method of daemonizing was all wrong, here is the documented way I used, and have been using for years. http://www.perldoc.com/perl5.6/pod/perlipc.html#Complete-Dissociation-of-Chi ld-from-Parent They gave the following example, which is exactly what I do: use POSIX 'setsid'; sub daemonize { chdir '/' or die "Can't chdir to /: $!"; open STDIN, '/dev/null' or die "Can't read /dev/null: $!"; open STDOUT, '>/dev/null' or die "Can't write to /dev/null: $!"; defined(my $pid = fork) or die "Can't fork: $!"; exit if $pid; setsid or die "Can't start a new session: $!"; open STDERR, '>&STDOUT' or die "Can't dup stdout: $!"; } > but the easy way to > do this is: > > use Proc::Daemon; # Available at a CPAN near you :-) > .... > Proc::Daemon::Init; I will have a look at that. Thanks. :) > But this still doesn't explain (at least to me) the lost connection. > > Unless the $dbh was created before daemonizing and the child > process closed the connection on exiting. No, $dbh is created inside the child. Basically the only purpose of my parent is to fork and to write a PID. I found another interesting article, at: http://artsandtechnology.humber.ac.uk/~dcobham/Teaching/CMC041/unixproc.html What is interesting about it, that they use a "sleep 5" too, directly after the fork () call. Apparently they reason Perl needs just a wee time to gets its signals / pipes in order for the child. And that may just really be all there is to it. Though it took me a darn while to figure out. :) - Mark --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php