The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
determine if the script has been invoked manually or not? hitmansilentass Shell Programming and Scripting 8 06-22-2008 11:32 AM
SFTP errorcode 1 when run on cron but runs manually Heidi.Ebbs SUN Solaris 2 08-08-2007 12:16 PM
script works on command line, not in cron job JackTheTripper UNIX for Dummies Questions & Answers 7 06-27-2007 01:51 AM
how to implement patch manually sheilly_2k7 UNIX for Advanced & Expert Users 1 05-03-2007 05:57 PM
Can run script Manually, but not through Cron? MadHatter Shell Programming and Scripting 4 10-19-2005 10:08 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-03-2006
dstinsman dstinsman is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 23
Works Manually - not in CRON

I've got a ksh script that works like a charm when I run it manually. When I set it up in a cron, I keep getting this error in my log:

syntax error at line 90: `$' unexpected

Here's my snippet of code starting at line 90:

while [[ ! -e $DATA_DIR/tuscprof.dat && $(date '+%H:%M') < 10:00 ]]
do
sleep 900
done

What's the problem?
  #2 (permalink)  
Old 03-03-2006
dangral dangral is offline Forum Advisor  
Registered User
  
 

Join Date: Oct 2002
Posts: 699
In the first line of your script put:

Code:
#! /usr/bin/ksh
  #3 (permalink)  
Old 03-03-2006
dstinsman dstinsman is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 23
It already has this line at the top, after the path:

. /usr/local/bin/TEST.env

PATH=/usr/lbin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/sbin:/bin:/usr/local/bin:$ORACLE_HOME:$ORACLE_HOME/bin:/apps:.; export PATH

SHELL=/bin/ksh
export SHELL

Mind you, this was not my original script so I don't know much about certain portions of it, including this one
  #4 (permalink)  
Old 03-03-2006
dangral dangral is offline Forum Advisor  
Registered User
  
 

Join Date: Oct 2002
Posts: 699
Quote:
Originally Posted by dstinsman
It already has this line at the top, after the path:

. /usr/local/bin/TEST.env

PATH=/usr/lbin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/sbin:/bin:/usr/local/bin:$ORACLE_HOME:$ORACLE_HOME/bin:/apps:.; export PATH

SHELL=/bin/ksh
export SHELL

Mind you, this was not my original script so I don't know much about certain portions of it, including this one
That's not going to help you. You need to put the line I suggested at the First line in the script.
  #5 (permalink)  
Old 03-03-2006
tmarikle tmarikle is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2005
Posts: 683
Quote:
Originally Posted by dstinsman
It already has this line at the top, after the path:

. /usr/local/bin/TEST.env

PATH=/usr/lbin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/sbin:/bin:/usr/local/bin:$ORACLE_HOME:$ORACLE_HOME/bin:/apps:.; export PATH

SHELL=/bin/ksh
export SHELL

Mind you, this was not my original script so I don't know much about certain portions of it, including this one
That's not what dangral is refering to.

The very first line of the script needs to be #! /usr/bin/ksh. This forces the execution shell to become a Korn shell and not SH as is your case. The specific line cannot come after anything and it must be line 1.
  #6 (permalink)  
Old 03-06-2006
dstinsman dstinsman is offline
Registered User
  
 

Join Date: Feb 2006
Posts: 23
My cron job worked all weekend. Thanks guys!
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:08 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0