�&ǐk�@'bJ�h�ۊL'}T� :��'2�Z#$��n�a��� �>a��`��_3d�Qpt�/�P -��#5�,�M��� �pA:©�q�����NW��ډ�A���� �9nʺج���� �TSM��{J6?7��r�@�\����D��� �׶���s�f�TJj?"��D��`?��̒� b�#�%�C*v�$�{�$����5Ծ�F�s��y�e/8��h-�f�̰&(����Gj�L:U� 2�� ����v�_k����Y��gp,�k�WF�R������_C�R��N@���R�@�ߔ?A�w9���F("iNa-S���Q�o�3tDMLh*�#4k�T/iQ��Y*�G��m����)��8�hBm/�I�,g�ﯖ���Z��}�Cz�q@´��d.����L�ŕ�,��1�Z�܌�: ̪���F+J-'��c�tvJ8��]Q-��b��y �6;*J`r_�d ��'�G ~p��)'�C,�%F��E(��2�k�����lР�z�!�=t ��_�0��f7��� ;�p�|�U �% (); __PACKAGE__->new(@ARGV)->run() unless caller(); =encoding utf-8 =head1 NAME clean_dead_mailman_locks =head1 USAGE clean_dead_mailman_locks [--help] =head1 DESCRIPTION This script removes and dead lock files in the mailman locks directory Since cPanel does not run mailman across multiple hosts, we can safely check for dead lock files even if mailman cannot. =cut sub run { my $lock_nodes = Cpanel::FileUtils::Dir::get_directory_nodes($LOCK_DIR); # Our mailman installs are not running cross servers # so we don't have the host boundary problem that # mailman things we do. This allow us to clean up # dead pid files. foreach my $lock_node (@$lock_nodes) { my $lock_string = Cpanel::LoadFile::load_if_exists("$LOCK_DIR/$lock_node"); my ($lock_pid) = $lock_string =~ m{\.([0-9]+)$}; next if !$lock_pid || $lock_pid < 10; if ( !_pid_is_alive($lock_pid) ) { print "Removed stale lock file “$lock_node” for pid “$lock_pid”.\n"; Cpanel::Autodie::unlink_if_exists("$LOCK_DIR/$lock_node"); } } return 1; } sub _pid_is_alive { my ($pid) = @_; local $!; if ( kill( 0, $pid ) ) { return 1; } elsif ($!) { require Errno; #kill() often fails when done as an unprivileged user if ( $! == Errno::EPERM() ) { return !!( stat "/proc/$pid" )[0]; } } return 0; }