X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=bin%2Frt-crontool;h=c8e07983fe6da5d16189e5cf66f6dcc4cee2b7c6;hb=af59614dbbf895bf0b0ab155fe158b6152edf32b;hp=7786b7c186f903bc680855e729cd1b9b7294f4ea;hpb=632513a6db31ba1c9e5151dc69cff85f7925c8bc;p=usit-rt.git diff --git a/bin/rt-crontool b/bin/rt-crontool index 7786b7c..c8e0798 100755 --- a/bin/rt-crontool +++ b/bin/rt-crontool @@ -50,30 +50,16 @@ use strict; use warnings; use Carp; -use lib '/www/data/rt/rt-perl/current-perl10/share/perl5'; -use lib '/www/data/rt/rt-perl/current-perl10/lib/perl5'; -use lib '/www/data/rt/rt-perl/current-perl10/lib64/perl5'; - -use lib ("/www/var/rt/local/lib", "/www/var/rt/lib"); - # fix lib paths, some may be relative -BEGIN { +BEGIN { # BEGIN RT CMD BOILERPLATE require File::Spec; + require Cwd; my @libs = ("lib", "local/lib"); my $bin_path; for my $lib (@libs) { unless ( File::Spec->file_name_is_absolute($lib) ) { - unless ($bin_path) { - if ( File::Spec->file_name_is_absolute(__FILE__) ) { - $bin_path = ( File::Spec->splitpath(__FILE__) )[1]; - } - else { - require FindBin; - no warnings "once"; - $bin_path = $FindBin::Bin; - } - } + $bin_path ||= ( File::Spec->splitpath(Cwd::abs_path(__FILE__)) )[1]; $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib ); } unshift @INC, $lib; @@ -87,9 +73,6 @@ use Getopt::Long; use RT::Interface::CLI qw(CleanEnv GetCurrentUser GetMessageContent loc); -#Clean out all the nasties from the environment -CleanEnv(); - my ( $search, $condition, $action, $search_arg, $condition_arg, $action_arg, $template, $template_id, $transaction, $transaction_type, $help, $log, $verbose ); GetOptions( @@ -112,11 +95,14 @@ GetOptions( RT::LoadConfig(); # adjust logging to the screen according to options -RT->Config->Set( LogToScreen => $log ) if $log; +RT->Config->Set( LogToSTDERR => $log ) if $log; #Connect to the database and get RT::SystemUser and RT::Nobody loaded RT::Init(); +# Clean out all the nasties from the environment +CleanEnv(); + require RT::Tickets; require RT::Template; @@ -319,37 +305,37 @@ sub help { . "\n"; print loc("It takes several arguments:") . "\n\n"; - print " " + print " " . loc( "[_1] - Specify the search module you want to use", "--search" ) . "\n"; - print " " + print " " . loc( "[_1] - An argument to pass to [_2]", "--search-arg", "--search" ) . "\n"; - print " " + print " " . loc( "[_1] - Specify the condition module you want to use", "--condition" ) . "\n"; - print " " + print " " . loc( "[_1] - An argument to pass to [_2]", "--condition-arg", "--condition" ) . "\n"; - print " " + print " " . loc( "[_1] - Specify the action module you want to use", "--action" ) . "\n"; - print " " + print " " . loc( "[_1] - An argument to pass to [_2]", "--action-arg", "--action" ) . "\n"; - print " " + print " " . loc( "[_1] - Specify name or id of template(s) you want to use", "--template" ) . "\n"; - print " " + print " " . loc( "[_1] - Specify if you want to use either 'first', 'last' or 'all' transactions", "--transaction" ) . "\n"; - print " " + print " " . loc( "[_1] - Specify the comma separated list of transactions' types you want to use", "--transaction-type" ) . "\n"; - print " " - . loc( "[_1] - Adjust LogToScreen config option", "--log" ) . "\n"; - print " " + print " " + . loc( "[_1] - Adjust LogToSTDERR config option", "--log" ) . "\n"; + print " " . loc( "[_1] - Output status updates to STDOUT", "--verbose" ) . "\n"; print "\n"; print "\n"; @@ -464,7 +450,7 @@ Specify the comma separated list of transactions' types you want to use =item log -Adjust LogToScreen config option +Adjust LogToSTDERR config option =item verbose