diff options
| author | Christopher Burger <burgerc@freeside.biz> | 2018-11-08 16:11:26 -0500 |
|---|---|---|
| committer | Christopher Burger <burgerc@freeside.biz> | 2018-11-08 16:11:26 -0500 |
| commit | 9fa789e54fd4cce845242895b3036a220f16cba4 (patch) | |
| tree | 077f0d008207af6c8c9e76a2b4bc4e2fa609b31e | |
| parent | a3aaddd8cfc8bdc9c065e17430fbeef883fe8b17 (diff) | |
| parent | 782c9989fba6332e28f25187da8d623bddaab466 (diff) | |
Merge branch 'FREESIDE_3_BRANCH' of ssh://git.freeside.biz/home/git/freeside into FREESIDE_3_BRANCH
| -rw-r--r-- | FS/FS/Cron/bill.pm | 22 | ||||
| -rw-r--r-- | FS/FS/access_user.pm | 11 | ||||
| -rwxr-xr-x | FS/bin/freeside-daily | 6 |
3 files changed, 30 insertions, 9 deletions
diff --git a/FS/FS/Cron/bill.pm b/FS/FS/Cron/bill.pm index caedcd3c1..a8a1860a4 100644 --- a/FS/FS/Cron/bill.pm +++ b/FS/FS/Cron/bill.pm @@ -22,7 +22,8 @@ use FS::Log; # -s: re-charge setup fees # -v: enable debugging # -l: debugging level -# -m: Experimental multi-process mode uses the job queue for multi-process and/or multi-machine billing. +# -m: Multi-process mode uses the job queue for multi-process and/or multi-machine billing. +# -q: Multi-process mode: queue additional job instead of skipping # -r: Multi-process mode dry run option # -g: Don't bill these pkgparts @@ -109,12 +110,15 @@ sub bill { warn "DRY RUN: would add custnum $custnum for queued_bill\n"; } else { + my @waiting = qsearch( 'queue', { + 'job' => 'FS::cust_main::queued_bill', + 'custnum' => $custnum, + 'status' => 'new', + } + ); + #avoid queuing another job if there's one still waiting to run - next if qsearch( 'queue', { 'job' => 'FS::cust_main::queued_bill', - 'custnum' => $custnum, - 'status' => 'new', - } - ); + next if @waiting && ! $opt{'q'}; #add job to queue that calls bill_and_collect with options my $queue = new FS::queue { @@ -124,6 +128,12 @@ sub bill { }; my $error = $queue->insert( 'custnum'=>$custnum, %args ); die $error if $error; + + #wait until the earler jobs complete + foreach $waiting_queue (@waiting) { + $queue->depend_insert($waiting_queue->jobnum); + } + } } else { diff --git a/FS/FS/access_user.pm b/FS/FS/access_user.pm index 9f4c34ddb..70cef4a6a 100644 --- a/FS/FS/access_user.pm +++ b/FS/FS/access_user.pm @@ -149,7 +149,16 @@ sub htpasswd_kludge { { return ''; } else { - return 'htpasswd exited unsucessfully'; + + if ($? == -1) { + return "htpasswd failed to execute: $!"; + } elsif ($? & 127) { + return sprintf("htpasswd died with signal %d, %s coredump", + ($? & 127), ($? & 128) ? 'with' : 'without' ); + } else { + return sprintf("htpasswd exited with value %d", $? >> 8 ); + } + } } diff --git a/FS/bin/freeside-daily b/FS/bin/freeside-daily index 5276a2ff0..f8122e751 100755 --- a/FS/bin/freeside-daily +++ b/FS/bin/freeside-daily @@ -8,7 +8,7 @@ use FS::Log; &untaint_argv; #what it sounds like (eww) use vars qw(%opt); -getopts("p:a:d:vl:sy:nmrkg:ox", \%opt); +getopts("p:a:d:vl:sy:nmqrkg:ox", \%opt); my $user = shift or die &usage; adminsuidsetup $user; @@ -127,7 +127,7 @@ freeside-daily - Run daily billing and invoice collection events. =head1 SYNOPSIS - freeside-daily [ -d 'date' ] [ -y days ] [ -p 'payby' ] [ -a agentnum,agentnum,... ] [ -s ] [ -o ] [ -v ] [ -l level ] [ -m ] [ -r ] [ -k ] user [ custnum custnum ... ] + freeside-daily [ -d 'date' ] [ -y days ] [ -p 'payby' ] [ -a agentnum,agentnum,... ] [ -s ] [ -o ] [ -v ] [ -l level ] [ -m [ -q ] [ -r ] ] [ -k ] user [ custnum custnum ... ] =head1 DESCRIPTION @@ -166,6 +166,8 @@ the bill and collect methods of a cust_main object. See L<FS::cust_main>. -m: Multi-process mode uses the job queue for multi-process and/or multi-machine billing. + -q: When using multi-process mode, queue a additional billing job even if ones for the customer are already in the queue + -r: Multi-process mode dry run option -k: skip notify_flat_delay |
