Monday, March 4, 2013

Python cx_Oracle not working in Cronjob

cx_Oracle error in Cronjob execution. I've found that
adding environment variables in the crontab works
like charm. Steps to check if the cx_Oracle work:
import cx_Oracle
print 'cx_Oracle works'
print 'cx_Oracle error'
In your crontab add,
 * * * * * python /path/to/
Notice that the cron will execute every minute.
You will received error notification in your email
$ tail /var/spool/mail/oracle

Edit your cron:

ORACLE_HOME = '/path/to/db_1'
LD_LIBRARY_PATH = '/path/to/db_1/lib:/lib:/usr/lib'

* * * * * python /path/to/

Save and exit, wait for cron to fire then check your
mail again. You should received 'cx_Oracle works'
notification. Hope it helps.

No comments: