use POSIX qw(setsid);
use Date::Format;
use IO::File;
-use FS::UID qw(adminsuidsetup forksuidsetup);
+use FS::UID qw(adminsuidsetup forksuidsetup driver_name);
use FS::Record qw(qsearchs);
use FS::queue;
# no autoloading just yet
use FS::cust_main;
use FS::svc_acct;
-use Net::SSH;
+use Net::SSH 0.05;
my $pid_file = '/var/run/freeside-queued.pid';
$SIG{__DIE__} = \&_die;
$SIG{__WARN__} = \&_logmsg;
-warn "freesied-queued starting\n";
+warn "freeside-queued starting\n";
while (1) {
'queue',
{ 'status' => 'new' },
'',
- 'ORDER BY jobnum FOR UPDATE LIMIT 1'
+ driver_name =~ /^mysql$/i
+ ? 'ORDER BY jobnum LIMIT 1 FOR UPDATE'
+ : 'ORDER BY jobnum FOR UPDATE LIMIT 1'
) or do {
sleep 5;
next;
warn "WARNING: can't fork: $!\n";
my %hash = $job->hash;
$hash{'status'} = 'failed';
+ $hash{'statustext'} = "[freeside-queued] can't fork: $!";
my $ljob = new FS::queue ( \%hash );
my $error = $ljob->replace($job);
die $error if $error;
#get new db handles
$FS::UID::dbh->{InactiveDestroy} = 1;
- $FS::svc_acct::icradius_dbh->{InactiveDestroy}
+ $FS::svc_acct::icradius_dbh->{InactiveDestroy} = 1
if $FS::svc_acct::icradius_dbh;
forksuidsetup($user);
warn "job $eval failed";
my %hash = $ljob->hash;
$hash{'status'} = 'failed';
+ $hash{'statustext'} = $@;
my $fjob = new FS::queue( \%hash );
my $error = $fjob->replace($ljob);
die $error if $error;