[Rt-commit] rt branch, 4.4/update-rt-fulltext-indexer-quiet-option, created. rt-4.4.4-456-gc4b2b909f8
Blaine Motsinger
blaine at bestpractical.com
Fri May 21 19:02:20 EDT 2021
The branch, 4.4/update-rt-fulltext-indexer-quiet-option has been created
at c4b2b909f87bd6811b93413d44e32069e28e9848 (commit)
- Log -----------------------------------------------------------------
commit c4b2b909f87bd6811b93413d44e32069e28e9848
Author: Blaine Motsinger <blaine at bestpractical.com>
Date: Fri May 21 17:28:37 2021 -0500
Update rt-fulltext-indexer quiet opt to be quiet
This commit updates the rt-fulltext-indexer quiet option to quiet
its STDERR output.
For the use case of running through cron, any errors or warnings
during RT initialization can now be silenced.
Without --quiet, STDERR output is now set to warning or higher.
With --quiet, STDERR output is now set to critical or higher.
diff --git a/sbin/rt-fulltext-indexer.in b/sbin/rt-fulltext-indexer.in
index 142ecf6f02..0672cef2f6 100644
--- a/sbin/rt-fulltext-indexer.in
+++ b/sbin/rt-fulltext-indexer.in
@@ -67,7 +67,6 @@ BEGIN { # BEGIN RT CMD BOILERPLATE
}
-use RT -init;
use RT::Interface::CLI ();
use HTML::Entities;
@@ -87,16 +86,31 @@ $OPT{limit} ||= 200;
RT::Interface::CLI->ShowHelp if $OPT{help};
+use RT;
+RT::LoadConfig();
+
+if ( $OPT{quiet} ) {
+ RT->Config->Set( LogToSTDERR => 'critical' );
+}
+else {
+ RT->Config->Set( LogToSTDERR => 'warning' );
+}
+
+RT::Init();
+
+$RT::Handle->LogSQLStatements(1) if RT->Config->Get('StatementLog');
+
+$| = 1;
+
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');
-----------------------------------------------------------------------
More information about the rt-commit
mailing list