467,198 Members | 1,210 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,198 developers. It's quick & easy.

Basic Cron job not working in UBUNTU

I have a file named query.sql inside which I have 2 lines as follows:

---------------------------------------------------------------------
connect to test;
select * from DF_MOVIE_MOVIE where movieid=10;

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

In crontab I have the following line:

-----------------------------------------------------------------------
32 15 * * * db2 -tvf '/home/db2inst1/query.sql' > a.out
-----------------------------------------------------------------------


If I run db2 -tvf '/home/db2inst1/query.sql' > a.out outside crontab, it runs fine and produces the output in a.out.....When I run it from crontab it only produces and empty a.out file at the specified time.

Can anyone help me out please?
Aug 31 '07 #1
  • viewed: 2310
Share:
1 Reply
docdiesel
Expert 100+
Hi,

In crontab I have the following line:
-----------------------------------------------------------------------
32 15 * * * db2 -tvf '/home/db2inst1/query.sql' > a.out
-----------------------------------------------------------------------

Make that

Expand|Select|Wrap|Line Numbers
  1. In crontab I have the following line:
  2. -----------------------------------------------------------------------
  3. 32 15 * * *   . ~/.profile ; db2 -tvf '/home/db2inst1/query.sql' > a.out
  4. -----------------------------------------------------------------------
  5.  
When running from crontab, the DB2 environment is missing. Setting it by premitting a ". ~/.profile" should fix this.

Regards, Bernd
Aug 31 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by sherryonline@gmail.com | last post: by
4 posts views Thread by vagrantbrad@yahoo.com | last post: by
3 posts views Thread by the.natalie@gmail.com | last post: by
3 posts views Thread by dburdick@isound.com | last post: by
4 posts views Thread by pushpen@gmail.com | last post: by
4 posts views Thread by Shelly | last post: by
1 post views Thread by symbioid | last post: by
reply views Thread by Cameron Simpson | last post: by
1 post views Thread by Karthik Gurusamy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.