The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
running script in cron - with ssh commands - not working frustrated1 Shell Programming and Scripting 31 09-16-2008 11:14 AM
Cron not working manna UNIX for Dummies Questions & Answers 1 01-10-2008 02:04 PM
Cron job not working dkranes UNIX for Dummies Questions & Answers 5 10-26-2007 12:01 PM
Cron not working? christo16 UNIX for Dummies Questions & Answers 5 03-09-2007 02:55 AM
cron not working DaleCabell UNIX for Dummies Questions & Answers 1 07-28-2006 08:16 PM

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

Join Date: Oct 2005
Location: Mumbai,India
Posts: 58
Thumbs up script not working in CRON

guys

i have written a very simple script .it runs manually well.
but when i put it in cron,it doesn't give the desired output.

script looks like this:

#! /usr/bin/sh
#script for loading data in table using ctl file/Abhijeet K/08.07.2006

/svm_wl1/. .profile
cd /svm_wl1/billing/data/server/log

rm SVM_WL1_WLN_DATA_USAGE.txt

a=`ls SVM_WL1_WLN_DATA_USAGE_2006*.txt`
echo "----------"
echo $a
echo "----------"
sleep 5

cp $a /svm_wl1/billing/data/server/archive/SVM_WL1_WLN_DATA_USAGE

echo $a > /svm_wl1/billing/data/server/log/test
b=`cut -b 1-22 /svm_wl1/billing/data/server/log/test`
echo "------------"
echo $b
echo "------------"
rm test
sleep 5
mv $a $b.txt

sqlldr <username>/<password>@<database_name> control=/svm_wl1/billing/data/server/log/DIA_USAGE.ctl log=/svm_wl1/billing/data/server/log/DIA_USAGE.log


echo "------"
echo "done"
echo "------"
date
echo "------"


If a run script manullay,data gets inserted in the table & a log file also gets generated but in cronjob script runs without insertion and log file generation.

i tried calling . .profile before the execution of script starts.
still no result.

any views/suggestions/corrections welcome

regards
abhijeet
  #2 (permalink)  
Old 07-11-2006
LochanM LochanM is offline
Registered User
  
 

Join Date: May 2006
Posts: 4
Hi

Are you sure your script is being called. How you have define in CRON entry.

Thanks
  #3 (permalink)  
Old 07-11-2006
abhijeetkul abhijeetkul is offline
Registered User
  
 

Join Date: Oct 2005
Location: Mumbai,India
Posts: 58
Thumbs up

yup
script is getting called. i am redirecting echo statements in a .txt file.

00 05 * * * /svm_wl1/billing/data/server/log/sqlldr.sh > /svm_wl1/billing/data/server/log/sqlldr.txt

this txt file gets modified on the scheduled time.
but data is not getting inserted in the table.

i feel it has something to do with the cron enviroment.
does cron sets up its own enviroment?

i have been facing cron problem for some time now.i write scripts,they run manually but fail in cron.


o/p of sqlldr.txt file is like this:

----------
SVM_WL1_WLN_DATA_USAGE_2006-07-10.txt
----------
------------
SVM_WL1_WLN_DATA_USAGE
------------
------
done
------
Tue Jul 11 05:00:10 IST 2006
------
  #4 (permalink)  
Old 07-11-2006
jyoung jyoung is offline
Registered User
  
 

Join Date: Nov 2001
Location: Flint, MI
Posts: 228
I would check this out in the FAQS section:
cron and crontab
  #5 (permalink)  
Old 07-11-2006
LochanM LochanM is offline
Registered User
  
 

Join Date: May 2006
Posts: 4
Please set your oracle home path from where you are connecting.

Thanks
  #6 (permalink)  
Old 07-13-2006
abhijeetkul abhijeetkul is offline
Registered User
  
 

Join Date: Oct 2005
Location: Mumbai,India
Posts: 58
Thumbs up

the problem is resolved.
i sourced the ".profile" of the user & it has worked.
thanks for the support.
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 07:42 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