[Rt-commit] rt branch 4.4/update-rt-fulltext-indexer-quiet-option created. rt-4.4.5-11-g0d2cd6237c

BPS Git Server git at git.bestpractical.com
Fri Dec 31 00:32:09 UTC 2021


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 4.4/update-rt-fulltext-indexer-quiet-option has been created
        at  0d2cd6237c7465c842ce6d4d6154413e71172ad7 (commit)

- Log -----------------------------------------------------------------
commit 0d2cd6237c7465c842ce6d4d6154413e71172ad7
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Fri May 21 18:35:07 2021 -0500

    Update docs for rt-fulltext-indexer --quiet

diff --git a/docs/full_text_indexing.pod b/docs/full_text_indexing.pod
index 5b94399ebc..b6342060e3 100644
--- a/docs/full_text_indexing.pod
+++ b/docs/full_text_indexing.pod
@@ -47,11 +47,10 @@ To keep the index up-to-date, you will need to run:
 tickets at a time; you can adjust this upwards by passing C<--limit
 500>.  Larger batch sizes will take longer and consume more memory.
 
-If there is already an instances of C<rt-fulltext-indexer> running, new
-ones will exit abnormally (with exit code 1) and the error message
-"rt-fulltext-indexer is already running."  You can suppress this message
-and end those processes normally (with exit code 0) using the C<--quiet>
-option; this is particularly useful when running the command via
+If there is already an instance of C<rt-fulltext-indexer> running, new
+ones will exit with the message "rt-fulltext-indexer is already running."
+You can suppress this message and other output to C<STDERR> using the
+C<--quiet> option; this is particularly useful when running the command via
 C<cron>:
 
     /opt/rt4/sbin/rt-fulltext-indexer --quiet
@@ -98,11 +97,10 @@ To keep the index up-to-date, you will need to run:
 tickets at a time; you can adjust this upwards by passing C<--limit
 500>.  Larger batch sizes will take longer and consume more memory.
 
-If there is already an instances of C<rt-fulltext-indexer> running, new
-ones will exit abnormally (with exit code 1) and the error message
-"rt-fulltext-indexer is already running."  You can suppress this message
-and end those processes normally (with exit code 0) using the C<--quiet>
-option; this is particularly useful when running the command via
+If there is already an instance of C<rt-fulltext-indexer> running, new
+ones will exit with the message "rt-fulltext-indexer is already running."
+You can suppress this message and other output to C<STDERR> using the
+C<--quiet> option; this is particularly useful when running the command via
 C<cron>:
 
     /opt/rt4/sbin/rt-fulltext-indexer --quiet
@@ -251,10 +249,9 @@ C<--memory> option:
     /opt/rt4/sbin/rt-fulltext-indexer --memory 10M
 
 If there is already an instance of C<rt-fulltext-indexer> running, new
-ones will exit abnormally (with exit code 1) and the error message
-"rt-fulltext-indexer is already running."  You can suppress this message
-and end those processes normally (with exit code 0) using the C<--quiet>
-option; this is particularly useful when running the command via
+ones will exit with the message "rt-fulltext-indexer is already running."
+You can suppress this message and other output to C<STDERR> using the
+C<--quiet> option; this is particularly useful when running the command via
 C<cron>:
 
     /opt/rt4/sbin/rt-fulltext-indexer --quiet

commit 651dafdae615184c64329f45c2aa1108e17b8c04
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Thu Dec 30 17:37:09 2021 -0600

    Exit success if rt-fulltext-indexer is running
    
    Without --quiet, rt-fulltext-indexer will exit error if already
    running.  Exiting error here can incorrectly indicate an error
    occurred, when none actually did.

diff --git a/sbin/rt-fulltext-indexer.in b/sbin/rt-fulltext-indexer.in
index 85d434cd1b..a0ff55b83e 100644
--- a/sbin/rt-fulltext-indexer.in
+++ b/sbin/rt-fulltext-indexer.in
@@ -89,13 +89,12 @@ RT::Interface::CLI->ShowHelp if $OPT{help};
 use Fcntl ':flock';
 if ( !flock main::DATA, LOCK_EX | LOCK_NB ) {
     if ( $OPT{quiet} ) {
-        RT::Logger->info("$0 is already running; aborting silently, as requested");
-        exit;
+        RT::Logger->info("$0 is already running");
     }
     else {
-        print STDERR "$0 is already running\n";
-        exit 1;
+        print "$0 is already running\n";
     }
+    exit;
 }
 
 my $max_size = RT->Config->Get('MaxFulltextAttachmentSize');

commit 0f5db256431057bf8b35d2df8f8a9931f3f78484
Author: Blaine Motsinger <blaine at bestpractical.com>
Date:   Fri May 21 17:28:37 2021 -0500

    Suppress warnings with rt-fulltext-indexer --quiet
    
    Warnings are printed to STDERR when rt-fulltext-indexer is run with
    --quiet.  This can lead to frequent emails with often unnecessary
    information if run through cron.
    
    This commit updates rt-fulltext-indexer to initialize its CLI
    options and RT through RT::Interface::CLI::Init rather than
    directly.  This changes --quiet to set LogToSTDERR to error which
    is more intuitive behavior and consistent with other RT scripts.

diff --git a/sbin/rt-fulltext-indexer.in b/sbin/rt-fulltext-indexer.in
index 12e22a9d6a..85d434cd1b 100644
--- a/sbin/rt-fulltext-indexer.in
+++ b/sbin/rt-fulltext-indexer.in
@@ -67,13 +67,12 @@ BEGIN { # BEGIN RT CMD BOILERPLATE
 
 }
 
-use RT -init;
-use RT::Interface::CLI ();
+use RT::Interface::CLI qw(Init);
 use HTML::Entities;
 
-use Getopt::Long qw(GetOptions);
 my %OPT = ( memory => '2M', limit => 0 );
-GetOptions( \%OPT,
+Init(
+    \%OPT,
     "help|h!",
     "debug!",
     "quiet!",

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list