LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   shell Script to execute multiple times,if not succeed send an email alert with the server status (https://www.linuxquestions.org/questions/programming-9/shell-script-to-execute-multiple-times-if-not-succeed-send-an-email-alert-with-the-server-status-4175614477/)

nareshreddyn 09-25-2017 07:37 AM

shell Script to execute multiple times,if not succeed send an email alert with the server status
 
For loop to execute three time and send an email alert if not succeed

pan64 09-25-2017 08:19 AM

help on what? What kind of help do you need at all? Do you have any problem?
You can try to insert set -xv at the beginning of your script to see what's happening.
instead of
Code:

ps -efww |grep ${app} | grep weblogic | gawk '{ print "kill -9 " $2 } ' | bash
you may try to use pkill, I think that will be better

ondoho 09-25-2017 12:13 PM

maybe:

Code:

for (( i=0 ; i<3 ; i++ )); do
    stuff && exit 0
done
mail "failed"
exit 1

this is close to bash, but not real code; just an idea.

TB0ne 09-25-2017 12:26 PM

Quote:

Originally Posted by nareshreddyn (Post 5762676)
For loop to execute three time and send an email alert if not succeed

Nareshreddyn, read the LQ Rules and "Question Guidelines".

Do not edit your original posts...you have removed the ENTIRE SCRIPT you had posted here, and this only makes your question harder to answer than it already was. We now have even less context for things than we did before. pan64 asked you for details, but instead of answering, you only gave us less.

We are happy to try to help you, but we can't unless you give us details and ask a clear question.

astrogeek 09-25-2017 02:26 PM

Please see the posting guidelines in the Site FAQ for acceptable use of these fora.

Please do not remove the original question or context as it creates a pointless thread and a dead-end link for others seeking help with similar issues, and is disrespectful of those who have taken the time to read it and may be working on a reply.

I see from the cached edits that you may have once more included the URL of your corporate server in the original code, as you did in your previous posts, which may have been the reason for your hasty edits. Please put more effort and thought into your questions before asking them to avoid that possibility in the future.


All times are GMT -5. The time now is 03:55 AM.