Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Advice on how to set up error handling Post 303005657 by SIMMS7400 on Friday 20th of October 2017 06:06:16 PM
Old 10-20-2017
Hi Rudi -

I will check that out now!

Here is what I have working for the time being - works fine. I will look at DEBUG.

Code:
echo ---------------------------------------------------------                                                                                                
echo "Execute Data Import & Export Procedures"                                         
echo ---------------------------------------------------------

#::-- Scripts will not  execute if missing a AWI/GSC Data File --::#
if [[ ! "${_ERR}" = "T" ]]
then
    cd "${_DAILYSALES_BIN}"

    perl 2passdatechange.pl 
    sleep 60
    startMaxl.sh oracle_PEL.mxl $MMDD1
    
        _RVAL=$?
        if [ $_RVAL -eq 0 ]
        then
            echo ---------------------------------------------------------                                                                                                
            echo "Oracle_PEL.mxl : Successful"                                         
            echo ---------------------------------------------------------
        else
            echo ---------------------------------------------------------                                                                                                
            echo "Oracle_PEL.mxl : Unsuccessful"                                         
            echo ---------------------------------------------------------
            _ERR=T
        fi

    if [[ ! "${_ERR}" = "T" && ${DDD} == "Sun" ]]
    then
        echo chmod -R 775 *.*
        startMaxl.sh dly05loadto_INP_cslawr.mxl
        sleep 1800
        
        _RVAL=$?
        if [ $_RVAL -eq 0 ]
        then
            echo ---------------------------------------------------------                                                                                                
            echo "dly05loadto_INP_cslawr.mxl : Successful"                                         
            echo ---------------------------------------------------------
        else
            echo ---------------------------------------------------------                                                                                                
            echo "dly05loadto_INP_cslawr.mxl : Unsuccessful"                                         
            echo ---------------------------------------------------------
            _ERR=T
        fi
            
        if [[ ! "${_ERR}" = "T" ]]
        then
        ./sunday_cslawr.ksh

            _RVAL=$?
            if [ $_RVAL -eq 0 ]
            then
                echo ---------------------------------------------------------                                                                                                
                echo "sunday_cslawr.ksh : Successful"                                         
                echo ---------------------------------------------------------
            else
                echo ---------------------------------------------------------                                                                                                
                echo "sunday_cslawr.ksh : Unsuccessful"                                         
                echo ---------------------------------------------------------
                _ERR=T
            fi
        fi
        
    fi
    sleep 60
    if [[ ! "${_ERR}" = "T" ]]
    then
    startMaxl.sh ascmon.mxl
        
        _RVAL=$?
        if [ $_RVAL -eq 0 ]
        then
            echo ---------------------------------------------------------                                                                                                
            echo "ascmon.mxl : Successful"                                         
            echo ---------------------------------------------------------
        else
            echo ---------------------------------------------------------                                                                                                
            echo "ascmon.mxl : Unsuccessful"                                         
            echo ---------------------------------------------------------
            _ERR=T
        fi
    fi
else
    echo "1 or more AWI or GSC data file(s) does not exist"
    echo "No further processing will be executed"
fi

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Error Handling -pls advice

Dear friends, I am using the below command in my unix script ----------------------------------------------- File_Name=`ls $CTRY*$DATE_SUFFIX*zip` --> Command-1 ..... if then unzip -a $File_Name -d $CTRY_DIR/$CTRY else echo "File for $CTRY dated $DATE_SUFFIX does not exist... (2 Replies)
Discussion started by: sureshg_sampat
2 Replies

2. Shell Programming and Scripting

SFTP Error Handling

Hi , Can any one tell me is there any standard method to track errors during sftp ? using which command i can track sftp errors ? i tried using echo $? . Most of the times i am getting error number 127 ,1, 255. whether it is constant numbers ? Please help me out. Thanks in advance (2 Replies)
Discussion started by: deepusunil
2 Replies

3. Shell Programming and Scripting

Error Handling

Helo Experts, I need a help in handling errors in shell script, wants my errors displayed in text file instead of command window.. My shell script is here; cd /cygdrive/s/Files for FILES in ./*.* do temp=`basename $FILES` if cp $FILES /cygdrive/r/CopyFile1/$FILES; then echo "copy... (5 Replies)
Discussion started by: CelvinSaran
5 Replies

4. Programming

C - advice how to catch some weird error

I have some unstable mistake in my program and out-of-idea how to catch it. I am looking for advice with a way to work it out! I have in a pretty complicated program (but one source file) set of int-counters - 15, if exactly. Lately, on final printout I have inpossible value (I am... (3 Replies)
Discussion started by: alex_5161
3 Replies

5. Shell Programming and Scripting

set -o vi giving set: Syntax error

when trying : set -o vi getting error like- : set: Syntax error help me Double post (of sorts). Continue here. (0 Replies)
Discussion started by: RahulJoshi
0 Replies

6. Red Hat

Advice regarding filesystems handling large number of files

Hi All, I have a CentOS operating system installed. I work with really huge number of files which are not only huge in number but some of them really huge in size. Minimum number of files could be 1 million to 2 million in one directory itself. Some of the files are even several Gigabytes in... (2 Replies)
Discussion started by: shoaibjameel123
2 Replies

7. Shell Programming and Scripting

Error Handling

Below code works for different databases i.e. MYSQL and ORACLE The problem is for MYSQL in Block: if ; $? taking value accordingly but in case of ORACLE $? is always taking this value as zero (0). That is the reason in Oracle it always going in else Block in any case.. :( and in case of ... (4 Replies)
Discussion started by: ambarginni
4 Replies

8. Shell Programming and Scripting

Error handling

Hello fellow UNIX gurus :) I have a problem regarding the script below: # Variables used in this shell. power=0 # Stores squared integer total=0 # Sum of all squared integers num=0 # Stores command line arguements # Provides error handling if command line... (5 Replies)
Discussion started by: Learn4Life
5 Replies

9. Shell Programming and Scripting

Error handling for file

Hi Guys, I got a csv with pipe delimted file and i want to check second column of the file has any alpha character becuase I am expecting only number in that, and if any alpha characters then it should throw an error Thanks in advance (1 Reply)
Discussion started by: Rizzu155
1 Replies

10. Shell Programming and Scripting

New advice on error checking

HI All, Whenever I write a shell script I always check if a command got executed successfully, even for the commands like cd, mv, rm and others, and even for the cases when there is ALMOST nothing to stop this commands from executing with success. so I am wondering if it is an overkill. I am... (1 Reply)
Discussion started by: rdogadin
1 Replies
All times are GMT -4. The time now is 06:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy