PNG  IHDR* pHYs+ IDATx]n#; cdLb Ǚ[at¤_:uP}>!Usă cag޿ ֵNu`ݼTâabO7uL&y^wFٝA"l[|ŲHLN밪4*sG3|Dv}?+y߉{OuOAt4Jj.u]Gz*҉sP'VQKbA1u\`& Af;HWj hsO;ogTu uj7S3/QzUr&wS`M$X_L7r2;aE+ώ%vikDA:dR+%KzƉo>eOth$z%: :{WwaQ:wz%4foɹE[9<]#ERINƻv溂E%P1i01 |Jvҗ&{b?9g=^wζXn/lK::90KwrюO\!ջ3uzuGv^;騢wq<Iatv09:tt~hEG`v;3@MNZD.1]L:{ծI3`L(÷ba")Y.iljCɄae#I"1 `3*Bdz>j<fU40⨬%O$3cGt]j%Fߠ_twJ;ABU8vP3uEԑwQ V:h%))LfraqX-ۿX]v-\9I gl8tzX ]ecm)-cgʒ#Uw=Wlێn(0hPP/ӨtQ“&J35 $=]r1{tLuǮ*i0_;NƝ8;-vݏr8+U-kruȕYr0RnC]*ެ(M:]gE;{]tg(#ZJ9y>utRDRMdr9㪩̞zֹb<ģ&wzJM"iI( .ꮅX)Qw:9,i좜\Ԛi7&N0:asϓc];=ΗOӣ APqz93 y $)A*kVHZwBƺnWNaby>XMN*45~ղM6Nvm;A=jֲ.~1}(9`KJ/V F9[=`~[;sRuk]rєT!)iQO)Y$V ی ۤmzWz5IM Zb )ˆC`6 rRa}qNmUfDsWuˤV{ Pݝ'=Kֳbg,UҘVz2ﴻnjNgBb{? ߮tcsͻQuxVCIY۠:(V뺕 ٥2;t`@Fo{Z9`;]wMzU~%UA蛚dI vGq\r82iu +St`cR.6U/M9IENDB`#!/usr/local/cpanel/3rdparty/bin/perl use strict; use warnings; use Time::HiRes (); use constant DOVECOT_PROCESS_NAMES => qw( dovecot dovecot-auth dovecot/pop3-login dovecot/imap-login dovecot/anvil dovecot/log dovecot/config dovecot/auth dovecot-wrap ); my $MAX_WAIT = 30; #seconds my $SLEEP_INTERVAL = 0.1; my $pidfile = '/var/run/dovecot/master.pid'; #---------------------------------------------------------------------- if ( "@ARGV" =~ m<--help> ) { print < ) { print "Master Dovecot process = $master_pid\n"; } else { warn "Invalid contents in “$pidfile”: [$master_pid]\n"; undef $master_pid; } } elsif ( $!{'ENOENT'} ) { print "“$pidfile” doesn’t exist!\n"; } else { die "open($pidfile): $!"; } my @CMD = qw( /usr/sbin/dovecot stop ); print "Executing “@CMD” …\n"; my $pid = fork(); die "Failed to fork child process for “@CMD”" if !defined $pid; if ( $pid ) { print "Waiting $MAX_WAIT seconds for process $pid to end …\n"; my $start = time(); my $killed; while ( !waitpid( $pid, 1 ) ) { if ( time > ( $start + $MAX_WAIT ) ) { print "Process $pid has taken over $MAX_WAIT seconds to shut down.\n"; kill 'KILL', $pid; waitpid($pid, 0); $killed = 1; last; } Time::HiRes::sleep($SLEEP_INTERVAL); } # If we killed the dovecot stop command we want to fallthrough to the rest of the shutdown # but not if it terminated with a legitimate error. exit 1 if $? && !$killed; } else { exec(@CMD) or die "Failed to run “@CMD”: $!"; } print "Done! Waiting $MAX_WAIT seconds for process $master_pid to end …\n"; if ( length $master_pid ) { my $start = time(); my $end; while ( !$end ) { if ( kill 'ZERO', $master_pid ) { if ( time > ( $start + $MAX_WAIT ) ) { print "Process $master_pid has taken over $MAX_WAIT seconds to shut down.\n"; _safekill_any_remaining_dovecot_processes(); $end = 1; } Time::HiRes::sleep($SLEEP_INTERVAL); } else { print "Dovecot is now shut down.\n"; # We may have some stragglers so we # do a safekill just in case in order to handle: # # Case 187449: /etc/init.d/dovecot does not stop # properly dovecot # # When stopping dovecot we are killing some processes # but a few of them might survive when dovecot-wrap is # stalled. _safekill_any_remaining_dovecot_processes(); $end = 1; } } } sub _safekill_any_remaining_dovecot_processes { print "Any remaining Dovecot processes will now be terminated.\n"; system( '/usr/local/cpanel/etc/init/safekill', DOVECOT_PROCESS_NAMES ); } 1;