cronjob...
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 8 of 8

Thread: cronjob...

Hybrid View

  1. #1
    Join Date
    Oct 2000
    Location
    Charlotte, USA
    Posts
    330
    Hi all,
    Some thing strange....
    I have script to trim my alert log....once in a week.
    I have tested the script several times manually it worked fine...(I have multi instances in a server)...db version 8.1.6.3 and os sunOS.
    When I set this in Cron it did not work/not working...
    meaning the script is starting correctly...getting info from ORATAB file and generating the final script to trim the logfile......last line in the script is to execute the trim file...but
    it is not executing the final scirpt saying could not find...the final trim script...
    I have set .profile in place too...
    I tried by chmod to 700/777 too...to final trim script no use.
    I tried specifying full path of the script too no use.
    Any one help me to resolve this.
    Thanks.
    Thanigaivasan.


  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Your question would be better answered at http://www.unix.com

    That being said, 90% of cronjob problems stem from environment settings being wrong.

    [Edited by marist89 on 06-10-2002 at 02:49 PM]
    Jeff Hunter
    marist89@yahoo.com
    http://marist89.blogspot.com/
    Get Firefox!
    "I pledge to stop eating sharks fin soup and will not do so under any circumstances."

  3. #3
    Join Date
    Dec 1999
    Location
    Alpharetta, GA, US
    Posts
    192
    can you post your script.

    Thanks
    Chandra
    Chan
    OCP7.3/8.0/8i/9i
    Sun Certified Sys. Admin

  4. #4
    Join Date
    Oct 2000
    Location
    Charlotte, USA
    Posts
    330
    this is my main SCript....
    #!/bin/ksh
    SCRIPT_DIR=/apps/oracle/bckup_scripts/TRIMLOG
    export SCRIPT_DIR
    awk -f $SCRIPT_DIR/DBnames /var/opt/oracle/oratab > $SCRIPT_DIR/List_NAMES
    awk -f $SCRIPT_DIR/Log_Trim $SCRIPT_DIR/List_NAMES > $SCRIPT_DIR/Trimlog
    chmod 755 /apps/oracle/bckup_scripts/TRIMLOG/Trimlog
    /apps/oracle/bckup_scripts/TRIMLOG/Trimlog




    Generated Trimlog script......
    #!/bin/ksh
    . $HOME/.profile
    set ORACLE_SID= wwwq
    export ORACLE_SID
    DUMP=`sqlplus -s username/passwd@wwwq@background_dump_dest.sql`
    export DUMP
    ALERTLOG=$DUMP/alert_wwwq.log
    export ALERTLOG
    if
    [[ -f $ALERTLOG ]]; then
    cp $ALERTLOG $DUMP/alert_wwwq.log.old
    tail -100 $ALERTLOG > $DUMP/project/alert_wwwq.log
    cp $DUMP/project/alert_wwwq.log $ALERTLOG
    rm $DUMP/project/alert_wwwq.log
    echo $ALERTLOG;
    fi
    #!/bin/ksh
    . $HOME/.profile
    set ORACLE_SID= XXX1
    export ORACLE_SID
    DUMP=`sqlplus -s username/passwd@XXX1@background_dump_dest.sql`
    export DUMP
    ALERTLOG=$DUMP/alert_XXX1.log
    export ALERTLOG
    if
    [[ -f $ALERTLOG ]]; then
    cp $ALERTLOG $DUMP/alert_XXX1.log.old
    tail -100 $ALERTLOG > $DUMP/project/alert_XXX1.log
    cp $DUMP/project/alert_XXX1.log $ALERTLOG
    rm $DUMP/project/alert_XXX1.log
    echo $ALERTLOG;
    fi
    #Bye...


    I have set env too.
    Thanks,
    Thanigaivasan.

  5. #5
    Join Date
    Dec 1999
    Location
    Alpharetta, GA, US
    Posts
    192
    under what user crontab you were trying to run this script.

    Thanks
    Chandra
    Chan
    OCP7.3/8.0/8i/9i
    Sun Certified Sys. Admin

  6. #6
    Join Date
    Oct 2000
    Location
    Charlotte, USA
    Posts
    330
    as ORACLE only..
    Thanks.
    Thanigaivasan.

  7. #7
    Join Date
    Nov 2001
    Posts
    335
    I could be wrong, but I think $HOME variable is not define when you run job in cronab.And if so your profile may not be executed. Try to export HOME first .
    One, who thinks that the other one who thinks that know and does not know, does not know either!

  8. #8
    Join Date
    Oct 2000
    Location
    Charlotte, USA
    Posts
    330
    Okay I will try with export $HOME....Thanks for the info...
    but,
    My doubt here is when oracle is logging in...obviously login directory will get set right?. why to export that again???.
    Thanks.
    Thanigaivasan.

Posting Permissions

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


Click Here to Expand Forum to Full Width