[Rt-commit] rt branch 4.4/update-rt-fulltext-indexer-quiet-option created. rt-4.4.5-11-g79e0f4122a
BPS Git Server
git at git.bestpractical.com
Tue Jan 4 00:57:02 UTC 2022
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 79e0f4122a7a5bcb9fa2e3c53852384eaf8d5375 (commit)
- Log -----------------------------------------------------------------
commit 79e0f4122a7a5bcb9fa2e3c53852384eaf8d5375
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 0248ed750a2d1c2e3d607073c119e49045aef130
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 da0acde8da..31f8387513 100644
--- a/sbin/rt-fulltext-indexer.in
+++ b/sbin/rt-fulltext-indexer.in
@@ -84,13 +84,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 0198947696fd7b4a9446c472956e79a2565e0545
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..da0acde8da 100644
--- a/sbin/rt-fulltext-indexer.in
+++ b/sbin/rt-fulltext-indexer.in
@@ -67,20 +67,14 @@ 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,
- "help|h!",
- "debug!",
- "quiet!",
-
+Init(
+ \%OPT,
"all!",
"limit=i",
-
"memory=s",
);
$OPT{limit} ||= 200;
@@ -90,7 +84,7 @@ 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");
+ RT->Logger->info("$0 is already running; aborting silently, as requested");
exit;
}
else {
@@ -384,8 +378,8 @@ sub process_pg_update {
# helper functions
sub debug { print @_, "\n" if $OPT{debug}; 1 }
-sub error { $RT::Logger->error(_(@_)); 1 }
-sub warning { $RT::Logger->warn(_(@_)); 1 }
+sub error { RT->Logger->error(_(@_)); 1 }
+sub warning { RT->Logger->warn(_(@_)); 1 }
=head1 NAME
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list