By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,851 Members | 1,746 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,851 IT Pros & Developers. It's quick & easy.

Basic Cron job not working in UBUNTU

P: 1
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
Share this Question
Share on Google+
1 Reply


docdiesel
Expert 100+
P: 297
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.