<div dir="ltr">Hi Jerry,<div><br></div><div>Just looked over your code.  It looks straightforward and complete to me.</div><div><br></div><div>My only question I may have is "<span style="font-size:12.8px">/var/spool/postfix/public/</span><wbr style="font-size:12.8px"><span style="font-size:12.8px">qmgr" being hard coded.  Is it possible for this path to vary depending on the postfix configuration on other systems?</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Apr 8, 2017 at 1:52 AM, Jerry Benton <span dir="ltr"><<a href="mailto:jerry.benton@mailborder.com" target="_blank">jerry.benton@mailborder.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">One last update to remove useless line.<div><br></div><div><br></div><div>  use IO::Socket::UNIX;</div><div><br></div><div><div>  sub KickMessage {</div><div>    my($queue2ids, $sendmail2) = @_;</div><div>    my($queue);</div><div><br></div><div>    # Do a kick for every queue that contains some message ids</div><div>    foreach $queue (keys %$queue2ids) {</div><div>      next unless $queue2ids->{$queue};</div><div><br></div><div>      my $pf_connection = '/var/spool/postfix/public/<wbr>qmgr';</div><div>      </div><div>      if(-S $pf_connection){</div><div>      <span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">       </span># UNIX</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">     </span>  <span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">       </span>my $fh = IO::Socket::UNIX->new(</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">                         </span> Type => SOCK_STREAM,</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">                           </span> Peer => $pf_connection,</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">                                </span> ) or</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">              </span>MailScanner::Log::WarnLog("<wbr>KickMessage coould not write to UNIX > $pf_connection");</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">                </span>print $fh "I";</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">           </span>close $fh;<span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">        </span></div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">   </span>  }elsif(-p $pf_connection){</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">      </span>  <span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">       </span># FIFO</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">             </span>open(my $fh, '>', $pf_connection) or</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">            </span>MailScanner::Log::WarnLog("<wbr>KickMessage coould not write to FIFO > $pf_connection");</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">                </span>print $fh "I";</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">           </span>close $fh;</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span>  }else{</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span>  <span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">       </span>MailScanner::Log::WarnLog("<wbr>Unable to determine socket type (FIFO/UNIX) > $pf_connection");</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span>  }</div><div>    }</div><div>    return 0;</div><div>  }</div><div><br></div><div>
<div style="color:rgb(0,0,0);font-family:Tahoma;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br>-<br>Jerry Benton<br><a href="http://www.mailborder.com" target="_blank">www.mailborder.com</a><br><a href="tel:(844)%20436-6245" value="+18444366245" target="_blank">+1 - 844-436-6245</a><br><br><br></div>

</div>
<br><div><blockquote type="cite"><div>On Apr 8, 2017, at 1:46 AM, Jerry Benton <<a href="mailto:jerry.benton@mailborder.com" target="_blank">jerry.benton@mailborder.com</a>> wrote:</div><br class="m_1702971124178118443Apple-interchange-newline"><div><div style="word-wrap:break-word">I have it working under both FIFO and UNIX, so I guess I did it right. Final code for record keeper’s sake:<div><br></div><div><br></div><div>  use IO::Socket::UNIX;</div><div><br></div><div><div><div>  sub KickMessage {</div><div>    my($queue2ids, $sendmail2) = @_;</div><div>    my($queue);</div><div><br></div><div>    # Do a kick for every queue that contains some message ids</div><div>    foreach $queue (keys %$queue2ids) {</div><div>      next unless $queue2ids->{$queue};</div><div><br></div><div>      my $pf_connection = '/var/spool/postfix/public/<wbr>qmgr';</div><div>      </div><div>      if(-S $pf_connection){</div><div>      <span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span># UNIX</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">     </span>  <span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">       </span>my $fh = IO::Socket::UNIX->new(</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">                         </span> Type => SOCK_STREAM,</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">                           </span> Peer => $pf_connection,</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">                                </span> ) or</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">              </span>MailScanner::Log::WarnLog("<wbr>KickMessage coould not write to UNIX > $pf_connection");</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">                </span>print $fh "I";</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">           </span>close $fh;<span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">        </span></div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">   </span>  }elsif(-p $pf_connection){</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">      </span>  <span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">       </span># FIFO</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">             </span>my $fh = new FileHandle;</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">           </span>open(my $fh, '>', $pf_connection) or</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">            </span>MailScanner::Log::WarnLog("<wbr>KickMessage coould not write to FIFO > $pf_connection");</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">                </span>print $fh "I";</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">           </span>close $fh;</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span>  }else{</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span>  <span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">       </span>MailScanner::Log::WarnLog("<wbr>Unable to determine socket type (FIFO/UNIX) > $pf_connection");</div><div><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span>  }</div><div>    }</div><div>    return 0;</div><div>  }</div></div><div><br></div><div>
<div style="font-family:Tahoma;font-size:12px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br>-<br>Jerry Benton<br><a href="http://www.mailborder.com/" target="_blank">www.mailborder.com</a><br><a href="tel:(844)%20436-6245" value="+18444366245" target="_blank">+1 - 844-436-6245</a><br><br><br></div>

</div>
<br><div><blockquote type="cite"><div>On Apr 7, 2017, at 6:58 PM, Jerry Benton <<a href="mailto:jerry.benton@mailborder.com" target="_blank">jerry.benton@mailborder.com</a>> wrote:</div><br class="m_1702971124178118443Apple-interchange-newline"><div><div>I am trying to update some Perl code that checks if a socket is FIFO or UNIX and then executes appropriately. I am not entirely sure about the UNIX socket I am creating here. Can any Perl gurus chime in? <br><br>use IO::Socket::UNIX;<br><br><br>      my $pf_connection = '/var/spool/postfix/public/<wbr>qmgr';<br>      if(-p $pf_connection){<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">   </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span># FIFO<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span>my $fh = new FileHandle;<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">        </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span>$fh->open($pf_connection) or<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span>MailScanner::Log::WarnLog("<wbr>KickMessage coould not write to FIFO " .<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">        </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span>  "%s, %s", "$public/qmgr", $!);<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">   </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span>print $fh "I";<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">        </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span>$fh->close;<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span>  }elsif(-S $pf_connection){<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">   </span>  <span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">       </span># UNIX<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span>  <span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">       </span>my $fh = IO::Socket::UNIX->new(<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">      </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span> Type => SOCK_STREAM,<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">        </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span> Peer => $pf_connection,<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">     </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span> ) or<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">   </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span>MailScanner::Log::WarnLog("<wbr>KickMessage coould not write to UNIX " .<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">        </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span>  "%s, %s", "$public/qmgr", $!);<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">   </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span>print $fh "I";<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">        </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span>$fh->close; <span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">   </span><br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">        </span>  }else{<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">       </span>  <span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">       </span>MailScanner::Log::WarnLog("<wbr>Unable to determine socket type (FIFO/UNIX) " .<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">  </span>  "%s, %s", "$public/qmgr", $!);<br><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap">   </span>  }<br><br><br><br>-<br>Jerry Benton<br><a href="http://www.mailborder.com/" target="_blank">www.mailborder.com</a><br><a href="tel:(844)%20436-6245" value="+18444366245" target="_blank">+1 - 844-436-6245</a><br><br><br><br></div></div></blockquote></div><br></div></div></div></blockquote></div><br></div></div><br><br>
<br>
--<br>
MailScanner mailing list<br>
<a href="mailto:mailscanner@lists.mailscanner.info">mailscanner@lists.mailscanner.<wbr>info</a><br>
<a href="http://lists.mailscanner.info/mailman/listinfo/mailscanner" rel="noreferrer" target="_blank">http://lists.mailscanner.info/<wbr>mailman/listinfo/mailscanner</a><br>
<br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr">Shawn Iverson<div>Director of Technology</div><div>Rush County Schools</div><div>765-932-3901 x271</div><div><a href="mailto:iversons@rushville.k12.in.us" target="_blank">iversons@rushville.k12.in.us</a></div><div><br></div><div><img src="https://docs.google.com/uc?export=download&id=0Bw5iD0ToYvs_cy1OZFNIZ0drYVU&revid=0Bw5iD0ToYvs_UitIcHVIWkJVVTl2VGpxVUE0d0FQcHBIRXk4PQ" width="96" height="96" style="font-size:12.8px"><br></div></div></div></div></div></div></div></div></div>
</div>