summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2011-02-27 20:25:24 +0000
committerivan <ivan>2011-02-27 20:25:24 +0000
commitf5d9de8462352731400dbb7ab8ad39fea3b051a8 (patch)
tree9195683b3bd9e97c880071c8dbfca585d47ee9a9
parent764a378144dd65f0f56de0e307c8ea84bcead370 (diff)
add start of torrus srvderive daemon, RT#10574
-rw-r--r--FS/bin/freeside-torrus-srvderive8
1 files changed, 5 insertions, 3 deletions
diff --git a/FS/bin/freeside-torrus-srvderive b/FS/bin/freeside-torrus-srvderive
index 6708cc69b..9ecfbbc72 100644
--- a/FS/bin/freeside-torrus-srvderive
+++ b/FS/bin/freeside-torrus-srvderive
@@ -8,7 +8,7 @@ use FS::UID qw( adminsuidsetup dbh driver_name );
use FS::Record qw( qsearch str2time_sql str2time_sql_closing concat_sql );
use FS::torrus_srvderive;
-our $DEBUG = 1;
+our $DEBUG = 3;
my $user = shift or die &usage;
$FS::Daemon::PID_NEWSTYLE = 1;
@@ -51,7 +51,7 @@ my $sql = "
AND ABS( $_date - $other_date ) <= 60
)
ORDER BY srv_date, srv_time
- LIMIT 10
+ LIMIT 100
";
while (1) {
@@ -67,11 +67,13 @@ while (1) {
$sth->execute($serviceid, $serviceid) or die $sth->errstr;
my $prev = 0;
while ( my $row = $sth->fetchrow_arrayref ) {
+ last if sigterm() || sigint();
+
my( $srv_date, $srv_time ) = @$row;
my $cur = str2time( "$srv_date $srv_time" );
next if $cur-$prev <= 60;
last if time - $cur <= 300;
-
+
warn "no $serviceid for $srv_date $srv_time; adding\n"
if $DEBUG;
$found++;