halfbaked has asked for the wisdom of the Perl Monks concerning the following question:
Here's the relevant code.2013-11-21 23:10:37 [MIME::Lite 13557] : **** DIE!!! **** error closin +g /usr/lib/sendmail: No child processes (exit -1) Additionally, an error occurred sending the alert email: error closin +g /usr/lib/sendmail: No child processes (exit -1) 2013-11-21 23:10:37 [Proc::PID::File 13557] : **** Permission denied a +t /usr/local/share/perl/5.14.2/Proc/PID/File.pm line 224 during globa +l destruction.
And here's the code the starts the process.while (my $row = $get_sth->fetchrow_hashref) { if ($row->{messagetext} && $row->{messagehtml}) { if ($debug == 1) { $row->{recipient} = 'webdev@naplesrentals.com'; $msgcnt++; } my $status = 'sent'; my $message = new MIME::Lite( To => $row->{recipient}, From => $row->{sender}, Subject => $row->{subject}, Type => 'multipart/alternative'); $message->attach(Type=>'text/plain', Data=>$row->{messagetext}); $message->attach(Type=>'text/html', Data=>$row->{messagehtml}); $upd_sth->execute($status, $row->{messageid}); $message->send_by_sendmail or logmsg('Warning'); logmsg("Delivered message: MessageID: " . $row->{messa +geid}); } else { $upd_sth->execute('error', $row->{messageid}); logmsg("Invalid message: MessageID: " . $row->{message +id} . " Next!"); } }
The init_mailer_daemon function ...sub start { my $self = shift; my $name = $self->name; if (my $pid = fork()) { # parent + + exit 0; } #Child + + if (Proc::PID::File->running({name=>$name})) { die "Couldn't start: '$name' already running."; } $self->init_mailer_daemon; }
sub init_mailer_daemon { my $self = shift; my $name = $self->name; print "Starting: '$name'\n"; *CORE::GLOBAL::warn = \&warn_to_log; $SIG{__DIE__} = \&die_to_log; $SIG{__WARN__} = \&warn_to_log; eval { chdir '/' or die $!; open STDIN, '/dev/null' or die $!; open(STDOUT, '>>' . $self->logfile); open(STDERR, '+>&STDOUT'); logmsg('Starting Listmanager'); POSIX::setsid or die $!; logmsg('Successful'); }; if ($@) { die "Couldn't start child '$name': $@"; } local $SIG{CHLD} = 'IGNORE'; &queue; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Mime::Lite Sendmail Dying
by Corion (Patriarch) on Nov 22, 2013 at 07:38 UTC | |
by halfbaked (Sexton) on Nov 22, 2013 at 13:22 UTC | |
by Corion (Patriarch) on Nov 22, 2013 at 13:46 UTC | |
by halfbaked (Sexton) on Nov 23, 2013 at 23:52 UTC | |
|
Re: Mime::Lite Sendmail Dying
by kcott (Archbishop) on Nov 22, 2013 at 06:17 UTC | |
by Corion (Patriarch) on Nov 22, 2013 at 07:34 UTC | |
by Anonymous Monk on Nov 22, 2013 at 07:58 UTC | |
by jellisii2 (Hermit) on Nov 22, 2013 at 12:56 UTC | |
by Anonymous Monk on Nov 22, 2013 at 14:36 UTC | |
by halfbaked (Sexton) on Nov 22, 2013 at 13:23 UTC |