The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
problem with cron job solne SUN Solaris 7 01-18-2008 04:57 PM
cron problem! blowtorch UNIX for Advanced & Expert Users 4 03-07-2006 09:12 PM
Problem with cron jhansrod AIX 2 11-25-2005 12:30 PM
cron problem VPN UNIX for Dummies Questions & Answers 2 04-16-2004 03:27 AM
Cron Problem Raiden Shell Programming and Scripting 4 11-16-2003 03:00 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-06-2002
Registered User
 

Join Date: Jun 2001
Posts: 35
Stumble this Post!
Cron problem?

here's the scoop..

I have a ksh shell script written, that when I run it manually, it works wonderful, when I let it run via cron, it runs (tells me I have it set up correctly) but yet it doesn't run correctly (it only runs part of the commands with the script). what gives?

I've got the #!/bin/ksh thing in the begining of my script....

thanks in advance!

Todd
Forum Sponsor
  #2 (permalink)  
Old 06-06-2002
LivinFree's Avatar
Goober Extraordinaire
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
Stumble this Post!
In the script, are you using the full path to all of the command?
  #3 (permalink)  
Old 06-07-2002
Registered User
 

Join Date: Jun 2001
Posts: 35
Stumble this Post!
I tried that and still no luck. I think the issue lies in an enviroment variable though the line of code that isn't executing is that of another application. I fully qualified the path and still no luck...
  #4 (permalink)  
Old 06-07-2002
Registered User
 

Join Date: Jun 2002
Location: North Texas
Posts: 3
Stumble this Post!
If you suspect a possible environment issue, try turning on xtrace ("#/bin/ksh -x") mode inside of your script and letting cron run it. All the trace will then be mailed to you by the cron scheduler. Examining that may show you what is the issue.

Alternatively you can have the cron dump all "visible" output to a couple of log files.

#cron entry
01 * * * * /scriptpath/script >/logs/good.out 2>/logs/badout

(substitute the appropriate schedule of course)

Lastly, unless your .profile has some interactive (requires responses from you) elements you could always source that at the beginning of your script
#!/bin/ksh
#capture any command line params first
some_var=$1
# etc
. ${HOME}/.profile

(is what I do for most of my scripts at work)

That way the environment is the same under cron and when you run it manually.

Just suggestions

Good luck.
  #5 (permalink)  
Old 06-07-2002
Registered User
 

Join Date: Jun 2001
Posts: 35
Stumble this Post!
thanks Random! sourceing my .profile fixed it!!
Google The UNIX and Linux Forums
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 04: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