The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Cron not running garric UNIX for Advanced & Expert Users 6 04-11-2008 05:32 AM
Cron not running .. please help beisaikong Shell Programming and Scripting 2 07-12-2007 04:05 AM
cron job is not running Suguna UNIX for Advanced & Expert Users 3 09-28-2006 06:11 AM
Cron Job Not Running nag_sundaram HP-UX 1 10-17-2005 07:38 AM
running cron jobs ted Shell Programming and Scripting 1 05-19-2004 09:35 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-10-2003
Registered User
 

Join Date: Nov 2001
Location: Atlanta, GA
Posts: 31
Stumble this Post!
not running in cron

I have written a shell script and when i run it from shell prompt it runs fine but in the cron it only runs partially.
That means cron is working fine.
there is a command which i am using in the script which doesn't run at all.
That comman uses different user privileges like ptadmin
i am not sure how to make this work.
What I am thinking is that particular comman exports the database from oracle and it take 20-25 min to execute it while i run manually. but in the cron it looks like it doesn't even try it.
Although i have checked the log file and cron is creating log file so its executing but.
Any thoughts fellows.

tx
Forum Sponsor
  #2 (permalink)  
Old 07-10-2003
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Stumble this Post!
Check your environment differences between command line and cron.

$ env > /tmp/mycommandline.env

and add that command to your script
env > /tmp/mycron.env

Then check that you are giving the full path to commands in your script.

Read the man page on cron, crontab for further information such as:

The shell is invoked from your $HOME directory with an arg0
of sh. Users who desire to have their .profile executed must
explicitly do so in the crontab file.
  #3 (permalink)  
Old 07-11-2003
flim flam flamma jamma
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
Stumble this Post!
you could always just source your .profile or what ever into your script.

at the top of the script do a . ./.your_profile_goes_here
  #4 (permalink)  
Old 07-11-2003
Registered User
 

Join Date: Nov 2001
Location: Atlanta, GA
Posts: 31
Stumble this Post!
thanks fellows..
I have added my commandline enviornment to my script ..
it didn't work but later on i changed my shell to k shell and it worked like piece of cake.
In ksh after my enviornment variable i used export.
e.g.
PATH=/usr/abc:/usr/bcd; export PATH;
..

does somebody know how to do the same in csh & bourne shell.

Thanks again
  #5 (permalink)  
Old 07-11-2003
RTM's Avatar
RTM RTM is offline
Hog Hunter
 
Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Stumble this Post!
sh would use the same command as ksh - csh would be

% setenv PATH /usr/abc:/usr/bcd

For csh, you would put this in the .login file, not the .profile.
Google The UNIX and Linux Forums
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:17 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0