<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Yes. I updated the code already and tested it. This will be the final. Thanks for taking a look. <div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class="">sub KickMessage {</div><div class=""> my($queue2ids, $sendmail2) = @_;</div><div class=""> my($queue);</div><div class=""><br class=""></div><div class=""> # Do a kick for every queue that contains some message ids</div><div class=""> foreach $queue (keys %$queue2ids) {</div><div class=""> next unless $queue2ids->{$queue};</div><div class=""> </div><div class=""> my $pf_dir = $queue;</div><div class=""> $pf_dir =~ s/[^\/]+$/public/;</div><div class=""> $pf_dir = "$pf_dir/qmgr";</div><div class=""> </div><div class=""> if(-S $pf_dir){</div><div class=""> <span class="Apple-tab-span" style="white-space:pre"> </span># UNIX</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span> <span class="Apple-tab-span" style="white-space:pre"> </span>my $fh = IO::Socket::UNIX->new(</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span> Type => SOCK_STREAM,</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span> Peer => $pf_dir,</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span> ) or</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>MailScanner::Log::WarnLog("KickMessage coould not write to UNIX > $pf_dir");</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>print $fh "I";</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>close $fh;<span class="Apple-tab-span" style="white-space:pre"> </span></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span> }elsif(-p $pf_dir){</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span> <span class="Apple-tab-span" style="white-space:pre"> </span># FIFO</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>open(my $fh, '>', $pf_dir) or</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>MailScanner::Log::WarnLog("KickMessage coould not write to FIFO > $pf_dir");</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>print $fh "I";</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>close $fh;</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span> }else{</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span> <span class="Apple-tab-span" style="white-space:pre"> </span>MailScanner::Log::WarnLog("Unable to determine socket type (FIFO/UNIX) > $pf_dir");</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span> }</div><div class=""> }</div><div class=""> return 0;</div><div class=""> }</div><div class=""><br class=""></div><div class="">
<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; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><br class="">-<br class="">Jerry Benton<br class=""><a href="http://www.mailborder.com" class="">www.mailborder.com</a><br class="">+1 - 844-436-6245<br class=""><br class=""><br class=""></div>
</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Apr 8, 2017, at 7:10 AM, Shawn Iverson <<a href="mailto:iversons@rushville.k12.in.us" class="">iversons@rushville.k12.in.us</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Jerry,<div class=""><br class=""></div><div class="">Just looked over your code. It looks straightforward and complete to me.</div><div class=""><br class=""></div><div class="">My only question I may have is "<span style="font-size:12.8px" class="">/var/spool/postfix/public/</span><wbr style="font-size:12.8px" class=""><span style="font-size:12.8px" class="">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 class=""><div class="gmail_quote">On Sat, Apr 8, 2017 at 1:52 AM, Jerry Benton <span dir="ltr" class=""><<a href="mailto:jerry.benton@mailborder.com" target="_blank" class="">jerry.benton@mailborder.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">One last update to remove useless line.<div class=""><br class=""></div><div class=""><br class=""></div><div class=""> use IO::Socket::UNIX;</div><div class=""><br class=""></div><div class=""><div class=""> sub KickMessage {</div><div class=""> my($queue2ids, $sendmail2) = @_;</div><div class=""> my($queue);</div><div class=""><br class=""></div><div class=""> # Do a kick for every queue that contains some message ids</div><div class=""> foreach $queue (keys %$queue2ids) {</div><div class=""> next unless $queue2ids->{$queue};</div><div class=""><br class=""></div><div class=""> my $pf_connection = '/var/spool/postfix/public/<wbr class="">qmgr';</div><div class=""> </div><div class=""> if(-S $pf_connection){</div><div class=""> <span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span># UNIX</div><div class=""><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 class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span> Type => SOCK_STREAM,</div><div class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span> Peer => $pf_connection,</div><div class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span> ) or</div><div class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span>MailScanner::Log::WarnLog("<wbr class="">KickMessage coould not write to UNIX > $pf_connection");</div><div class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span>print $fh "I";</div><div class=""><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 class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span> }elsif(-p $pf_connection){</div><div class=""><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 class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span>open(my $fh, '>', $pf_connection) or</div><div class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span>MailScanner::Log::WarnLog("<wbr class="">KickMessage coould not write to FIFO > $pf_connection");</div><div class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span>print $fh "I";</div><div class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span>close $fh;</div><div class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span> }else{</div><div class=""><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 class="">Unable to determine socket type (FIFO/UNIX) > $pf_connection");</div><div class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span> }</div><div class=""> }</div><div class=""> return 0;</div><div class=""> }</div><div class=""><br class=""></div><div class="">
<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;" class=""><br class="">-<br class="">Jerry Benton<br class=""><a href="http://www.mailborder.com/" target="_blank" class="">www.mailborder.com</a><br class=""><a href="tel:(844)%20436-6245" value="+18444366245" target="_blank" class="">+1 - 844-436-6245</a><br class=""><br class=""><br class=""></div>
</div>
<br class=""><div class=""><blockquote type="cite" class=""><div class="">On Apr 8, 2017, at 1:46 AM, Jerry Benton <<a href="mailto:jerry.benton@mailborder.com" target="_blank" class="">jerry.benton@mailborder.com</a>> wrote:</div><br class="m_1702971124178118443Apple-interchange-newline"><div class=""><div style="word-wrap:break-word" class="">I have it working under both FIFO and UNIX, so I guess I did it right. Final code for record keeper’s sake:<div class=""><br class=""></div><div class=""><br class=""></div><div class=""> use IO::Socket::UNIX;</div><div class=""><br class=""></div><div class=""><div class=""><div class=""> sub KickMessage {</div><div class=""> my($queue2ids, $sendmail2) = @_;</div><div class=""> my($queue);</div><div class=""><br class=""></div><div class=""> # Do a kick for every queue that contains some message ids</div><div class=""> foreach $queue (keys %$queue2ids) {</div><div class=""> next unless $queue2ids->{$queue};</div><div class=""><br class=""></div><div class=""> my $pf_connection = '/var/spool/postfix/public/<wbr class="">qmgr';</div><div class=""> </div><div class=""> if(-S $pf_connection){</div><div class=""> <span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span># UNIX</div><div class=""><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 class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span> Type => SOCK_STREAM,</div><div class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span> Peer => $pf_connection,</div><div class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span> ) or</div><div class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span>MailScanner::Log::WarnLog("<wbr class="">KickMessage coould not write to UNIX > $pf_connection");</div><div class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span>print $fh "I";</div><div class=""><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 class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span> }elsif(-p $pf_connection){</div><div class=""><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 class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span>my $fh = new FileHandle;</div><div class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span>open(my $fh, '>', $pf_connection) or</div><div class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span>MailScanner::Log::WarnLog("<wbr class="">KickMessage coould not write to FIFO > $pf_connection");</div><div class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span>print $fh "I";</div><div class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span>close $fh;</div><div class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span> }else{</div><div class=""><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 class="">Unable to determine socket type (FIFO/UNIX) > $pf_connection");</div><div class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span> }</div><div class=""> }</div><div class=""> return 0;</div><div class=""> }</div></div><div class=""><br class=""></div><div class="">
<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" class=""><br class="">-<br class="">Jerry Benton<br class=""><a href="http://www.mailborder.com/" target="_blank" class="">www.mailborder.com</a><br class=""><a href="tel:(844)%20436-6245" value="+18444366245" target="_blank" class="">+1 - 844-436-6245</a><br class=""><br class=""><br class=""></div>
</div>
<br class=""><div class=""><blockquote type="cite" class=""><div class="">On Apr 7, 2017, at 6:58 PM, Jerry Benton <<a href="mailto:jerry.benton@mailborder.com" target="_blank" class="">jerry.benton@mailborder.com</a>> wrote:</div><br class="m_1702971124178118443Apple-interchange-newline"><div class=""><div class="">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 class=""><br class="">use IO::Socket::UNIX;<br class=""><br class=""><br class=""> my $pf_connection = '/var/spool/postfix/public/<wbr class="">qmgr';<br class=""> if(-p $pf_connection){<br class=""><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 class=""><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 class=""><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 class=""><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 class="">KickMessage coould not write to FIFO " .<br class=""><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 class=""><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 class=""><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 class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span> }elsif(-S $pf_connection){<br class=""><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 class=""><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 class=""><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 class=""><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 class=""><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 class=""><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 class="">KickMessage coould not write to UNIX " .<br class=""><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 class=""><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 class=""><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 class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span> }else{<br class=""><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 class="">Unable to determine socket type (FIFO/UNIX) " .<br class=""><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 class=""><span class="m_1702971124178118443Apple-tab-span" style="white-space:pre-wrap"> </span> }<br class=""><br class=""><br class=""><br class="">-<br class="">Jerry Benton<br class=""><a href="http://www.mailborder.com/" target="_blank" class="">www.mailborder.com</a><br class=""><a href="tel:(844)%20436-6245" value="+18444366245" target="_blank" class="">+1 - 844-436-6245</a><br class=""><br class=""><br class=""><br class=""></div></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></div><br class=""><br class="">
<br class="">
--<br class="">
MailScanner mailing list<br class="">
<a href="mailto:mailscanner@lists.mailscanner.info" class="">mailscanner@lists.mailscanner.<wbr class="">info</a><br class="">
<a href="http://lists.mailscanner.info/mailman/listinfo/mailscanner" rel="noreferrer" target="_blank" class="">http://lists.mailscanner.info/<wbr class="">mailman/listinfo/mailscanner</a><br class="">
<br class="">
<br class=""></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div dir="ltr" class=""><div dir="ltr" class="">Shawn Iverson<div class="">Director of Technology</div><div class="">Rush County Schools</div><div class="">765-932-3901 x271</div><div class=""><a href="mailto:iversons@rushville.k12.in.us" target="_blank" class="">iversons@rushville.k12.in.us</a></div><div class=""><br class=""></div><div class=""><img src="https://docs.google.com/uc?export=download&id=0Bw5iD0ToYvs_cy1OZFNIZ0drYVU&revid=0Bw5iD0ToYvs_UitIcHVIWkJVVTl2VGpxVUE0d0FQcHBIRXk4PQ" width="96" height="96" style="font-size:12.8px" class=""><br class=""></div></div></div></div></div></div></div></div></div>
</div>
<br class=""><br class="">-- <br class="">MailScanner mailing list<br class=""><a href="mailto:mailscanner@lists.mailscanner.info" class="">mailscanner@lists.mailscanner.info</a><br class="">http://lists.mailscanner.info/mailman/listinfo/mailscanner<br class=""><br class=""></div></blockquote></div><br class=""></div></body></html>