Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
06-20-2017, 12:36 PM
|
#1
|
Member
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310
Rep:
|
Check program on server
I do not know how or where to begin so I'm hoping that someone has a script already developed.
I have a program installed on a Weblogic server called "edq". I want to make sure that the program is running, not that the server is running. Is this possible? If you can you please provide a sample script.
|
|
|
06-20-2017, 12:46 PM
|
#2
|
Member
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310
Original Poster
Rep:
|
I forgot to mention, if the program running on the server is not running, to send an email and text message
|
|
|
06-20-2017, 01:55 PM
|
#3
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,894
|
Quote:
Originally Posted by trickydba
I do not know how or where to begin so I'm hoping that someone has a script already developed.
I have a program installed on a Weblogic server called "edq". I want to make sure that the program is running, not that the server is running. Is this possible? If you can you please provide a sample script.
|
Hi trickydba,
How do you now determine if the program is running? Do you use a ps command using that program as a grep string? Or do you have no idea how to determine if this program is running?
What form of scripting did you have in mind? Bash scripting?
I'm sure members here will have plenty of ideas how to proceed, but please note that it is best that you learn how to develop a script so that you can understand the solution and be able to modify it, should a future need arise to change it somehow. Also please note that asking for a script handout from members is not the best way to approach this.
The most simple bash script starts with the shebang line #!/bin/bash and then has commands in it, which are usually same commands that you'd have in a terminal prompt. If you use the ps command with the -e argument, you can pipe that into a grep command and check the return from the grep to see that your find was, or was not successful.
Can you please let others know how well or not you know any scripting language so that they can offer you some pointers?
For bash, there is a basic guide, here. I would suggest you check out chapter 7 where it describes conditional operators and you can see if you can determine how to check the output of a grep within a script and use that.
|
|
1 members found this post helpful.
|
06-20-2017, 02:21 PM
|
#4
|
Member
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310
Original Poster
Rep:
|
This is what I have so far..
Quote:
#! /bin/bash
service="./yowsup/yowsup-cli" # or service="yowsup-cli"
if pidof "$service" >/dev/null; then
echo "not running"
else
echo "running"
fi
|
I'm trying now to get the actual path to the executable. I like this option because I can provide the path to the actual file instead of messing with PIDs.
|
|
|
06-20-2017, 04:12 PM
|
#5
|
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,861
|
A very good open-source framework for this sort of thing is called Nagios.
This is a general-purpose infrastructure monitoring tool which has a lot of different plug-ins to do a variety of tasks, including monitoring that a program is running.
Does the program in question, perchance, open a TCP/IP socket, so that you could scan to see if the socket is still open?
|
|
1 members found this post helpful.
|
06-21-2017, 09:29 AM
|
#6
|
Member
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310
Original Poster
Rep:
|
No it doesn't. I have decided on taking another route on this issue
|
|
|
06-22-2017, 02:13 AM
|
#7
|
LQ Addict
Registered: Dec 2013
Posts: 19,872
|
so how did you solve this?
fwiw...
Quote:
Originally Posted by trickydba
I have a program installed on a Weblogic server called "edq". I want to make sure that the program is running, not that the server is running. Is this possible?
|
Code:
ssh your.server /path/to/localscript
localscript (situated on your server):
Code:
pidof edq || mail me
|
|
1 members found this post helpful.
|
06-22-2017, 07:49 AM
|
#8
|
Member
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310
Original Poster
Rep:
|
I don't think I will be granted permission to create CRON jobs.
@ondoho..........so am I to use the 2 lines of code you provided above to create a script to schedule?
|
|
|
06-22-2017, 08:00 AM
|
#9
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,894
|
Quote:
Originally Posted by trickydba
This is what I have so far..
Code:
#! /bin/bash
service="./yowsup/yowsup-cli" # or service="yowsup-cli"
if pidof "$service" >/dev/null; then
echo "not running"
else
echo "running"
fi
I'm trying now to get the actual path to the executable. I like this option because I can provide the path to the actual file instead of messing with PIDs.
|
Quote:
Originally Posted by trickydba
No it doesn't. I have decided on taking another route on this issue
|
I think what might be helpful would be some more details on whether or not your previous code you cited was doing the job correctly, or what you felt was non-ideal about it which you needed to change. In other words, what did you mean by providing the path to the actual file and how did you feel this would resolve the detection problem?
Or, now what different route are you following for this?
Quote:
Originally Posted by trickydba
I don't think I will be granted permission to create CRON jobs.
@ondoho..........so am I to use the 2 lines of code you provided above to create a script to schedule?
|
This sort of concerns me. If you are in a position where you are trying to do things, but have limitations because you are not root or are not an administrator of this system, then are you communicating with the persons who are? My concerns are that you are limited, and as a result, recommendations made by everyone may not be helpful given these limitations.
|
|
1 members found this post helpful.
|
06-22-2017, 10:53 AM
|
#10
|
Member
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310
Original Poster
Rep:
|
Since I've been on this site, regardless of my limited access to commands I've received a ton of help. If not limited it takes a LOOOOOOONG time to get access to certain commands.Cause of the nature of my job is why they are how they are. The alternative I have chose to do is for Oracle EDQ to read the database and use that as step one then simply create another step that sends an email stating that the service is up and running
|
|
|
06-22-2017, 11:29 AM
|
#11
|
Moderator
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,894
|
Quote:
Originally Posted by trickydba
Since I've been on this site, regardless of my limited access to commands I've received a ton of help. If not limited it takes a LOOOOOOONG time to get access to certain commands.Cause of the nature of my job is why they are how they are. The alternative I have chose to do is for Oracle EDQ to read the database and use that as step one then simply create another step that sends an email stating that the service is up and running
|
Hi,
That's fine.
My intent was to find out from you where you reside with this particular problem.
Are you still working with a script form and trying to derive a better way? Are you looking into the recommendation by ondoho? Or is there a different direction you've taken, as you indicated in post #6?
|
|
1 members found this post helpful.
|
06-23-2017, 07:53 AM
|
#12
|
Member
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310
Original Poster
Rep:
|
How I resolved this issue is to create a Project in Oracle EDQ to send an email at 9pm everyday just as a heads up that the service is still running and the scheduled Jobs will run as expected. I know something could happen in between 9 and 12 (which is the time the Job is scheduled to run) but I'll handle that when the time comes.
|
|
|
All times are GMT -5. The time now is 09:42 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|