LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 06-20-2017, 12:36 PM   #1
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Rep: Reputation: Disabled
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.
 
Old 06-20-2017, 12:46 PM   #2
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
I forgot to mention, if the program running on the server is not running, to send an email and text message
 
Old 06-20-2017, 01:55 PM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,319
Blog Entries: 13

Rep: Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372
Quote:
Originally Posted by trickydba View Post
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.
Old 06-20-2017, 02:21 PM   #4
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
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.
 
Old 06-20-2017, 04:12 PM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,148
Blog Entries: 4

Rep: Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232Reputation: 3232
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.
Old 06-21-2017, 09:29 AM   #6
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
No it doesn't. I have decided on taking another route on this issue
 
Old 06-22-2017, 02:13 AM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 17,253
Blog Entries: 10

Rep: Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160
so how did you solve this?

fwiw...
Quote:
Originally Posted by trickydba View Post
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.
Old 06-22-2017, 07:49 AM   #8
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
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?
 
Old 06-22-2017, 08:00 AM   #9
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,319
Blog Entries: 13

Rep: Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372
Quote:
Originally Posted by trickydba View Post
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 View Post
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 View Post
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.
Old 06-22-2017, 10:53 AM   #10
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
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
 
Old 06-22-2017, 11:29 AM   #11
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,319
Blog Entries: 13

Rep: Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372Reputation: 4372
Quote:
Originally Posted by trickydba View Post
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.
Old 06-23-2017, 07:53 AM   #12
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

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


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
Need program/script to check server status thetawaverider Linux - Software 1 02-27-2007 12:58 PM
Health Check / Server Completion Check Software? tells Linux - Enterprise 0 04-20-2006 11:03 AM
a RAM check program? kpachopoulos Linux - General 2 11-06-2005 04:59 PM
how to check the return value of a program Sammy2ooo Linux - General 1 04-27-2004 02:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:19 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
Open Source Consulting | Domain Registration