If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > [HELP] db2 v9.7 query is not run by crontab in RHEL5.4

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-24-10, 12:58
britantyo britantyo is offline
Registered User
 
Join Date: Oct 2010
Location: jakarta
Posts: 3
Question [HELP] db2 v9.7 query is not run by crontab in RHEL5.4

Dear all,

this is my first thread and my first post too, so i'm the newbie here. my username is my real name. howdy y'all.

okay ehm...about the problem :

i create alotta perl script that contains DB2 query. yes i'm using DBD:B2 module. i used db2 8.2 enterprise before in RHEL 5.2 in development machine and it's running well when my perl script run by crontab. time goes by (2 years development). and now they (my client) asked for the lattest tech from me. so i give'em RHEL 5.4 and db2 9.7 workgroup.

the surprise is when i try to put the script in crontab. IT'S NOT RUNNING (i'm so dead) . it run well when i run it manually (no error nor warning). the /var/log/cron tell me that the script is run, but actually, it was stopped when it was running the DB2 query part. what should i do

could someone help me. pleeeeeeeeeasse
Reply With Quote
  #2 (permalink)  
Old 10-24-10, 20:14
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
The problem is obviously on line 11 of your script.
Reply With Quote
  #3 (permalink)  
Old 10-25-10, 09:01
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Do load the db2 profile in your cron script?

Andy
Reply With Quote
  #4 (permalink)  
Old 11-19-10, 06:55
britantyo britantyo is offline
Registered User
 
Join Date: Oct 2010
Location: jakarta
Posts: 3
sooooo, let get this straight.

i run

$ db2set -g

and get these value :

DB2SYSTEM=britantyo
DB2INSTDEF=db2inst1
DB2ADMINSERVER=dasusr1

and then i have to put these value to /etc/crontab under PATH variable

or

i get all db2 environment variable in :

$ env

and put all these value of db2 in /etc/crontab :

DB2INSTANCE=db2inst1
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/db2inst1/sqllib/bin:/home/db2inst1/sqllib/adm:/home/db2inst1/sqllib/misc
CLASSPATH=/home/db2inst1/sqllib/java/db2java.zip:/home/db2inst1/sqllib/java/db2jcc.jar:/home/db2inst1/sqllib/java/sqlj.zip:/home/db2inst1/sqllib/function:/home/db2inst1/sqllib/java/db2jcc_license_cu.jar:.
LD_LIBRARY_PATH=/home/db2inst1/sqllib/lib32


i used to have my db2 V8.2 and it doesn't need to put anyting inside /etc/crontab

Reply With Quote
  #5 (permalink)  
Old 11-19-10, 08:50
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
The first line of my cron scripts all start with:
. /home/db2inst1/sqllib/db2profile


This loads the db2 profile for the cron session, which is necessary to do DB2 work in the session.

Andy
Reply With Quote
  #6 (permalink)  
Old 12-20-10, 12:43
britantyo britantyo is offline
Registered User
 
Join Date: Oct 2010
Location: jakarta
Posts: 3
Lightbulb

hey that works...thanks alot ARWinner. how can i thank you . now the cron work properly.

but frankly, i don't have to do that in V8.2

THANKS A LOT
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On