X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FCron%2Fcheck.pm;h=75247fbaf4213cd54eb566bfe2a20a09b4b5e69a;hb=8d0e8149e7b19ad8543ac6c8c663be63dbc34762;hp=b331014abb47646ae4700154f464536cc71b9531;hpb=25cf511573ebff303700ce71611450ad72debcbc;p=freeside.git diff --git a/FS/FS/Cron/check.pm b/FS/FS/Cron/check.pm index b331014ab..75247fbaf 100644 --- a/FS/FS/Cron/check.pm +++ b/FS/FS/Cron/check.pm @@ -6,6 +6,9 @@ use vars qw( @ISA @EXPORT_OK $DEBUG $FS_RUN $error_msg ); use Exporter; use LWP::UserAgent; +use HTTP::Request; +use URI::Escape; +use Email::Send; use FS::Conf; use FS::Record qw(qsearch); use FS::cust_pay_pending; @@ -13,7 +16,6 @@ use FS::cust_pay_pending; @ISA = qw( Exporter ); @EXPORT_OK = qw( check_queued check_selfservice check_apache check_bop_failures - check_sg check_sgng alert error_msg ); @@ -45,54 +47,6 @@ sub check_selfservice { return 1; } -sub check_sg { - my $conf = new FS::Conf; - return 1 unless $conf->exists('sg-multicustomer_hack'); - - my $ua = new LWP::UserAgent; - $ua->agent("FreesideCronCheck/0.1 " . $ua->agent); - - #XXX shiiiiit. - my $USER = ''; - my $PASS = ''; - my $req = new HTTP::Request GET=>"https://$USER:$PASS\@localhost/sg/ping.cgi"; - my $res = $ua->request($req); - - return 1 if $res->is_success - && $res->content =~ /OK/; - - $error_msg = $res->is_success ? $res->content : Rres->status_line; - return 0; - -} - -sub check_sgng { - my $conf = new FS::Conf; - return 1 unless $conf->exists('sg-multicustomer_hack'); - - eval 'use RPC::XML; use RPC::XML::Client;'; - if ($@) { $error_msg = $@; return 0; }; - - my $cli = RPC::XML::Client->new('https://localhost/selfservice/xmlrpc.cgi'); - my $resp = $cli->send_request('FS.SelfService.XMLRPC.ping'); - - return 1 if ref($resp) - && ! $resp->is_fault - && ref($resp->value) - && $resp->value->{'pong'} == 1; - - #hua - $error_msg = ref($resp) - ? ( $resp->is_fault - ? $resp->string - : ( ref($resp->value) ? $resp->value->{'error'} - : $resp->value - ) - ) - : $resp; - return 0; -} - sub _check_fsproc { my $arg = shift; _check_pidfile( "freeside-$arg.pid" ); @@ -121,7 +75,7 @@ sub check_apache { } #and now for something entirely different... -my $num_consecutive_bop_failures = 50; +my $num_consecutive_bop_failures = 60; sub check_bop_failures { return 1 if grep { $_->statustext eq 'captured' }