If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Cron isnt working well

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-19-05, 23:25
shatishr shatishr is offline
Registered User
 
Join Date: Aug 2005
Location: Kuala Lumpur, MY
Posts: 108
Cron isnt working well

Morning,
Im having abit of trouble here..

I have a .sql and also .sh file in my unix system. It is supposed to update two tables in my oracle database.
When i run the .sh file, it does the work properly without problem but when I cron it, it does but the row is not reflected in my database.
Ive checked on the paths, commit and so on.. but have no idea why this is happening only when i cron it.


.sql
spool /app/ITRAKPI/Unspecified_Call/insert_unspecified.log

INSERT into PREPAID_IN_UNSPECIFIED_CALL VALUE(
SELECT to_date(COD_DATE, 'yyyymmdd'), NBR_CALLS, TOT_COST, TOT_DURATION
FROM NR_CHECK_CALLS_31
MINUS
SELECT COD_DATE, TOTAL_CALLS, TOTAL_COST, TOTAL_DURATION from PREPAID_IN_UNSPECIFIED_CALL);

commit;

spool off

exit



.sh
sqlplus username/password@IT_RA @/app/ITRAKPI/Unspecified_Call/insert_unspecified.sql
more /app/ITRAKPI/Unspecified_Call/insert_unspecified.log | mailx -s "Unspecified_Call_Insertion" shatishr@digi.com.my


cron command:
03 11 * * * /app/ITRAKPI/Unspecified_Call/insert_unspecified.sh




Anyone can analyze this and inform me whats the problem ? Im sure nothing is wrong with the codes since it can run when i do it manually. ??
Reply With Quote
  #2 (permalink)  
Old 09-20-05, 09:16
pdreyer pdreyer is offline
Registered User
 
Join Date: May 2005
Location: South Africa
Posts: 1,268
Cron does not execute your profile. You’ll have to include the profile settings (for path, etc.) in your script.
Reply With Quote
  #3 (permalink)  
Old 09-20-05, 21:57
shatishr shatishr is offline
Registered User
 
Join Date: Aug 2005
Location: Kuala Lumpur, MY
Posts: 108
thx a lot bro..
i just added this into my .sh file

#!/bin/sh
cd /home/shatishr
. .profile


and there it GOES !!!

thx thx !
Reply With Quote
  #4 (permalink)  
Old 09-21-05, 23:39
shatishr shatishr is offline
Registered User
 
Join Date: Aug 2005
Location: Kuala Lumpur, MY
Posts: 108
another question that I have.
I am trying to put a cc in the mailx code, anyone knows

I tried this way but it isnt working
more /app/ITRAKPI/Unspecified_Call/insert_unspecified.log | mailx -s "Unspecified_Call_Insertion" shatishr@digi.com.my -c sychong@digi.com.my
Reply With Quote
  #5 (permalink)  
Old 09-21-05, 23:44
shatishr shatishr is offline
Registered User
 
Join Date: Aug 2005
Location: Kuala Lumpur, MY
Posts: 108
if possible i want the topic to look like this Updation_Of_Unspecified_Call for 21/09/2005(which is todays date)

eventhough its not that important but i want to know how.
Thanks
Reply With Quote
  #6 (permalink)  
Old 09-22-05, 02:06
pdreyer pdreyer is offline
Registered User
 
Join Date: May 2005
Location: South Africa
Posts: 1,268
Code:
more /app/ITRAKPI/Unspecified_Call/insert_unspecified.log | mailx -s "Updation_Of_Unspecified_Call for `date '+%d/%m/%Y'`" -c sychong@digi.com.my shatishr@digi.com.my
Back qoutes around date command and -c moved
Reply With Quote
  #7 (permalink)  
Old 09-22-05, 05:47
shatishr shatishr is offline
Registered User
 
Join Date: Aug 2005
Location: Kuala Lumpur, MY
Posts: 108
pdreyer, this is what it exactly says

mailx: illegal option -- c
usage: mailx [-FUm] [-s subject] [-r address] [-h number] address ...
mailx -e
mailx [-UHLiNn] [-u user]
mailx -f [-UHLiNn] [filename]

any idea ?
Reply With Quote
  #8 (permalink)  
Old 09-22-05, 07:19
pdreyer pdreyer is offline
Registered User
 
Join Date: May 2005
Location: South Africa
Posts: 1,268
Nope, beets me, I'm using mailx version 5.0 on Sun Solaris

mailx [ -BdFintUv~ ] [ -b bcc ] [ -c cc ] [ -h number ]
[ -r address ] [ -s subject ] recipient ...
Reply With Quote
  #9 (permalink)  
Old 09-22-05, 23:32
shatishr shatishr is offline
Registered User
 
Join Date: Aug 2005
Location: Kuala Lumpur, MY
Posts: 108
pdreyer,
im using HP-UX Server, and am not sure why the -c isnt working but then i would do it this way..

more /app/ITRAKPI/Unspecified_Call/insert_unspecified.log | mailx -s "Updation_Of_Unspecified_Call for `date '+%d/%m/%Y'`" sychong@digi.com.my shatishr@digi.com.my

It works as well..
Thanks anyway.. U solved one of my biggest problem..
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On