Giter Club home page Giter Club logo

pdbctl's Introduction

pdbctl

PDB Management Tool

pdbctl's People

Contributors

josecarlospavon avatar

Watchers

 avatar

pdbctl's Issues

[improvement] Add unified error check function

This could be a potential solution:

function error_check
{
#       ----------------------------------------------------------------
#       Function for exit due to fatal program error
#               Accepts 1 argument:
#                       string containing descriptive error message
#               If notify is set to true, it sends an email alert
#               If the second argument is "exit", the function exits on an error
#
#       Use the following after each command you want to check for errors:
#               error_check "$LINENO: <message>" <exit>
#
#       ----------------------------------------------------------------
        if [ $? = "0" ]; then   #There was no error
                echo "`date +%F_%H-%M-%S`: ${SCRIPT} line $1 succeeded" >> $logfile 2>&1
        else    #there was an error
                        message="`date +%F_%H-%M-%S`: ${SCRIPT} line ${1:-"Unknown Error"} failed"
                        echo $message >> $logfile 2>&1

                        if [ "$2" = "exit" ]; then
                                emailSubject="`hostname` FATAL ERROR: DO NOT connect and start Hybris until this problem is corrected"
                        else
                                emailSubject="`hostname` non-fatal error: refresh continued. Please investigate ASAP"
                        fi

                        if [ "$notify" = "true" ]; then
                                echo "$message on `hostname`" | mail -s "$emailSubject" $email
                        fi
                        if [ "$2" = "exit" ]; then     #if the second argument is "exit", then stop execution
                                exit 1
                        fi
        fi
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.