LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 07:37 AM   #1
nareshreddyn
LQ Newbie
 
Registered: Sep 2017
Posts: 10

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 08:59 AM.
 
Old 09-25-2017, 08:19 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,838

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
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, 12:13 PM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
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, 12:26 PM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
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, 02:26 PM   #5
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

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



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 06:29 AM
send email to server to start shell script bic Red Hat 5 12-04-2009 09:06 AM
script to execute a command multiple times snr8fl3 Programming 5 11-17-2008 12:49 PM
LXer: Perl script to monitor disk space and send an email alert LXer Syndicated Linux News 1 02-23-2007 01:12 PM
Bash script to alert by email 3 times then stop. pmpc00 Linux - General 2 11-04-2004 07:23 AM

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

All times are GMT -5. The time now is 07:22 PM.

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
Open Source Consulting | Domain Registration