X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Fsbin%2Frt-fulltext-indexer.in;h=b90d8dacfc8438713921c44f5cdabc848b1da0b6;hp=b84ca94994819977beab735aa220aff49c4d654b;hb=c71b2dc296da6207c525a064d322f7153c284d4e;hpb=b95256aad16c4bdafd089d26c0f9147f3ec7755e diff --git a/rt/sbin/rt-fulltext-indexer.in b/rt/sbin/rt-fulltext-indexer.in index b84ca9499..b90d8dacf 100644 --- a/rt/sbin/rt-fulltext-indexer.in +++ b/rt/sbin/rt-fulltext-indexer.in @@ -84,8 +84,9 @@ use RT::Interface::CLI (); my %OPT = ( help => 0, debug => 0, + quiet => 0, ); -my @OPT_LIST = qw(help|h! debug!); +my @OPT_LIST = qw(help|h! debug! quiet); my $db_type = RT->Config->Get('DatabaseType'); if ( $db_type eq 'Pg' ) { @@ -122,6 +123,18 @@ 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; + } + else { + print STDERR "$0 is already running\n"; + exit 1; + } +} + my $fts_config = RT->Config->Get('FullTextSearch') || {}; unless ( $fts_config->{'Enable'} ) { print STDERR <alexmv@bestpractical.comE =cut +__DATA__