List:General Discussion« Previous MessageNext Message »
From:Duhaime Johanne Date:December 13 2004 4:28pm
Subject: DBI->connect does not work in crontab but works interactively
View as plain text  
Hello

I have a script that check the status of all innodb tables. It works
fine interactively. 

But not from the crontab tab.

Here is the error message and also a list of the environment variables
from the crontab

The message is about libz.so that does not exit:  but: 

 l /usr/local/lib/libz.so
lrwxrwxrwx   1 root     other         13 Nov 23 16:26
/usr/local/lib/libz.so -> libz.so.1.2.1*

 

Please if you have any idea of what is the problem, could you share it
with me?

Solaris 6, mysql-4.1.7 

 
Johanne Duhaime
 

---------------

Your "cron" job on mercure

perl /seqweb/mysql/myscripts/check_innodb.pl

produced the following output:

install_driver(mysql) failed: Can't load
'/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/auto/DBD/mysql/mysql.
so' for module DBD::mysql: ld.so.1: perl: fatal: libz.so: open failed:
No such file or directory at
/usr/local/lib/perl5/5.6.1/sun4-solaris/DynaLoader.pm line 206, <DBLIST>
line 1. at (eval 4) line 3 Compilation failed in require at (eval 4)
line 3, <DBLIST> line 1. Perhaps a required shared library or dll isn't
installed where expected at /seqweb/mysql/myscripts/check_innodb.pl line
53 

 

HOME = /seqweb/mysql

LD_LIBRARY_PATH =
/usr/openwin/lib:/usr/lib:/opt/lib:/usr/local/lib/perl5/site_perl/5.6.1/
sun4-solaris/auto/DBD/mysql

LOGNAME = mysql

PATH =
/seqweb/mysql:/usr/openwin/bin/xview:/usr/openwin/bin:/opt/IXImotif/bin:
/opt/bin:/usr/bin:/etc:/usr/ucb:/usr/local/lib/perl5/site_perl/5.6.1/sun
4-solaris/auto/DBD/mysql

SHELL = /usr/bin/sh

TZ = Canada/Eastern

 
 
--------script part
use Env;
use Env qw(PATH HOME TERM);
use Env qw($SHELL @LD_LIBRARY_PATH);
$ENV{'LD_LIBRARY_PATH'}
='/usr/openwin/lib:/usr/lib:/opt/lib:/usr/local/lib/perl
5/site_perl/5.6.1/sun4-solaris/auto/DBD/mysql';
$ENV{'PATH'}='/seqweb/mysql:/usr/openwin/bin/xview:/usr/openwin/bin:/opt
/IXImoti
f/bin:/opt/bin:/usr/bin:/etc:/usr/ucb:/usr/local/lib/perl5/site_perl/5.6
.1/sun4-
solaris/auto/DBD/mysql';
 
# added just to check environment
 foreach (sort keys %ENV) {
  print "$_  =  $ENV{$_}\n";
 }

# in bold the instruction that cause the message (line 53)
open (DBLIST, $DB_LIST); #list of all db we have
while (<DBLIST>) {
   my $db_name=$_;
   chomp($db_name);
   my $dsn = "DBI:mysql:$db_name:localhost";   # data source name
   my $dbh = DBI->connect ($dsn,$DBUSER, $DBPASS,
                        { RaiseError => 1, PrintError => 0 })
   or die "Could not connect to server: $DBI::err ($DBI::errstr)\n";
 
 
 
 

Thread
DBI->connect does not work in crontab but works interactivelyDuhaime Johanne13 Dec
  • Re: DBI->connect does not work in crontab but works interactivelyDan Nelson13 Dec
    • Re: DBI->connect does not work in crontab but works interactivelyDan Nelson13 Dec