rpoblem in running script
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: rpoblem in running script

  1. #1
    Join Date
    Oct 2000
    Location
    Charlotte, USA
    Posts
    330
    Hi friends.....Please help me....
    I have written script like below.....
    #!/bin/ksh (even #!/bin/awk -f also works and I tried)
    awk -f program1 filename > filename2
    awk -f program2 filename2 > scriptfile
    ksh scriptfile

    when I run it manullay it is working fine.....I am happy.
    when I put it in crontab it is putting me in sad saying
    scriptfile not found...but when I do ls -lrt file is there...what is the problem.
    should I include WAIT or SLEEP before executing scriptfile...
    I gave pull path even in script and tried...I got the same message in MAIL...
    permission is okay...for the same permission ksh works manullay..I
    have tried too....help please.
    Thanks.
    Thanigai.


  2. #2
    Join Date
    Oct 2000
    Location
    Saskatoon, SK, Canada
    Posts
    3,925
    On the crontab try giving the full path


    i.e

    /usr/local/.../scriptfile make sure the file permissions for the scriptfile had been set appropriately.

    else change it to

    chmod 750 scriptfile

    Hope this would help you.
    Sam
    Thanx
    Sam



    Life is a journey, not a destination!


  3. #3
    Join Date
    Oct 2000
    Location
    Charlotte, USA
    Posts
    330

    problem in running scripts

    Thanks SAM...
    I am doing with full path only.....and ofcourse with
    chmod 700 scriptfile ......
    sTILL it doesn't work.....
    I added....'wait' after the chmod and before the ./scriptfile to recognise
    the file from the directory....It is interesting..
    still it says file not found....but it does chmod 700.....
    wait a second,is it (may be) because the shell in awk...?.Please help.
    Thanks.
    Thanigai.

  4. #4
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    You must preface every file with the correct path if you are running from the crontab. I like to set an environment variable at the beginning of the script to define my directory and then preface the entries in the script with that environment variable.

    For example:
    #!/bin/ksh
    SCRIPT_DIR=/u01/scripts
    awk -f $SCRIPT_DIR/program1 $SCRIPT_DIR/filename > $SCRIPT_DIR/filename2
    awk -f $SCRIPT_DIR/program2 $SCRIPT_DIR/filename2 > $SCRIPT_DIR/scriptfile
    ksh $SCRIPT_DIR/scriptfile
    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."

  5. #5
    Join Date
    Oct 2000
    Location
    Charlotte, USA
    Posts
    330

    problem in running scr.....

    Hi friends Still I have the problem....I have given the full path too....
    Please help me out.....
    Here is the script I am running......in crontab....


    more ALERTLOG_TRIM

    #!/bin/ksh
    SCRIPT_DIR=/apps/oracle/bckup_scripts/TRIMLOG
    export SCRIPT_DIR
    #echo $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
    ksh $SCRIPT_DIR/Trimlog

    more List_NAMES
    SID1
    SID2
    SID3
    SID4
    SID5


    more Trimlog
    #!/bin/ksh
    . $HOME/.profile
    DUMP=`sqlplus -s system/passwd@SID1 @background_dump_dest.sql`
    ALERTLOG=$DUMP/alert_SID1.log
    export ALERTLOG
    if
    [[ -f $ALERTLOG ]]; then
    cp $ALERTLOG $DUMP/alert_SID1.log.old
    tail -100 $ALERTLOG > $DUMP/project/alert_SID1.log
    cp $DUMP/project/alert_SID1.log $ALERTLOG
    rm $DUMP/project/alert_SID1.log
    fi
    #!/bin/ksh
    . $HOME/.profile
    DUMP=`sqlplus -s system/passwd@SID2 @background_dump_dest.sql`
    ALERTLOG=$DUMP/alert_SID2.log
    export ALERTLOG
    if
    [[ -f $ALERTLOG ]]; then
    cp $ALERTLOG $DUMP/alert_SID2.log.old
    tail -100 $ALERTLOG > $DUMP/project/alert_SID2.log
    cp $DUMP/project/alert_SID2.log $ALERTLOG
    rm $DUMP/project/alert_SID2.log
    fi
    ..............continues for all sids.....

    fi
    Bye...


    still it says $SCRIPT_DIR/Trimlog not found....please help.
    Thanks.
    Thanigai.

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