Results 1 to 9 of 9
  1. #1
    Join Date
    Aug 2005
    Location
    Kuala Lumpur, MY
    Posts
    108

    Unanswered: 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. ??

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    Cron does not execute your profile. You’ll have to include the profile settings (for path, etc.) in your script.

  3. #3
    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 !

  4. #4
    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

  5. #5
    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

  6. #6
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    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

  7. #7
    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 ?

  8. #8
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    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 ...

  9. #9
    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..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •