LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-25-2017, 08:37 AM   #1
nareshreddyn
LQ Newbie
 
Registered: Sep 2017
Posts: 3

Rep: Reputation: Disabled
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

Last edited by nareshreddyn; 09-25-2017 at 09:59 AM.
 
Old 09-25-2017, 09:19 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,777

Rep: Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888Reputation: 2888
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
 
1 members found this post helpful.
Old 09-25-2017, 01:13 PM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 6,770
Blog Entries: 3

Rep: Reputation: 1628Reputation: 1628Reputation: 1628Reputation: 1628Reputation: 1628Reputation: 1628Reputation: 1628Reputation: 1628Reputation: 1628Reputation: 1628Reputation: 1628
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.
 
Old 09-25-2017, 01:26 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,258

Rep: Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436Reputation: 4436
Quote:
Originally Posted by nareshreddyn View Post
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.
 
Old 09-25-2017, 03:26 PM   #5
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,505
Blog Entries: 6

Rep: Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421Reputation: 2421
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.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Check status of a command in bash script and send email alert bmxakias Linux - Server 9 11-13-2016 07:29 AM
send email to server to start shell script bic Red Hat 5 12-04-2009 10:06 AM
script to execute a command multiple times snr8fl3 Programming 5 11-17-2008 01:49 PM
LXer: Perl script to monitor disk space and send an email alert LXer Syndicated Linux News 1 02-23-2007 02:12 PM
Bash script to alert by email 3 times then stop. pmpc00 Linux - General 2 11-04-2004 08:23 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration