I'm concious that this might be a Linux problem but maybe someone on the
list has had the same issue and solved it.

I copied out below one of the simplest functions from a perl script that I
need to schedule every day. When I run it interactively the table truncates
fine and I get all the print statements. However when I try to run it as a
cron job nothing happens to the table and I only get the first print
statement in a log file - but the script compiles without error and Oracle
doesn't feed back any errors either.

Here is the cron command :

00 00 * * * perl /pathtofile/script.pl  2>&1 >> /pathtologfile/logfile.txt
(Running on Linux 7.2 and I've tried is as a standard user and as root)

Here is the script :

#!/usr/bin/perl print "\n\n ***********   CRONTEST   ****************\n\n";
use DBI; use DBD::Oracle; $dbh1 = DBI->connect( "dbi:Oracle:dbase", "user",
"pword" ) or die "Can't connect to Oracel database: $DBI::errstr\n";
print "\n\n ***********   LOGGED IN OK   ****************\n\n"; my $sqlA =
qq{TRUNCATE TABLE TABLE_NAME};
my $sth1 = $dbh1->prepare($sqlA) or die "Can't prepare SQL statement:
$DBI::errstr\n";
$sth1->execute or die "Can't execute SQL statement: $DBI::errstr\n";
$dbh1 ->disconnect();
print "\n\n ***********   LOGGED OUT OK   ****************\n\n";
exit;

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to