Sponsored Content
Top Forums Shell Programming and Scripting Script counting instances of software running on a machine Post 302621987 by muogli on Wednesday 11th of April 2012 10:42:22 AM
Old 04-11-2012
Script counting instances of software running on a machine

Hello to all @here,

as Iīm new to this forum, I will try to start in a easy way for my first post. Iīm not beginner in scripting, but also not a proffessional. So please keep easy, if I donīt understand your explanation at once Smilie I donīt mean it in a bad way!

Here is the Problem:
There were about 470 Servers running in my company. The most of them were hardware, on which are running mostly virtual machines. On this virtual machines are running Application Servers like WebLogic (Oracle), WebSphere (IBM), JBoss, Apache, TomCat and some other applications that donīt matter to me. My job is now, to check all servers and to analyze how many of this applications were actually running at the same time.
Some of the applications is maintained by the customer, some by our company. But all machines were from our company. So the point is, to create a script, which will count the applications running on a system.
My first intention was, to go over to the machine, and put a script on it, that will count the applications. But I donīt have thought on one important point. Some of the machines could be maintained by the owner or a colleague, so that there is no process running at this time, when my script starts. Maybe somebody over here, have a better solution for me, how to handle this problem.
***
Actually Iīm standing at this point, that I have created a script, that takes a ps -ef and greps out the processes that were important to me over ssh to a special server. But if the machine is not running the application, I will get back no result. So I tried now in another step, to take the find command, to find the path of an apache, WAS, WLS, ...and so on. My next problem that occured was, that some customers have saved their installations of WAS, WLS, JBoss, Apache ... under different directories with different names. Some call it WebLogic, others WLS1, other OracleWebLogic and some in companynames or crypted names. The main thing is, that all of this applications use apache or tomcat as a communication plattform for extern connections.
Now there were 2 different ways to go on. I can create a script, that can be stored local on the virtual machine, or I can store it on a central place and work with a list, of all available servers, to solve my problem. What is the best way, what do you thing and what would you prefer in this way? Do you have an other solution for me? Maybe I need some other impulses?!!?!? Smilie
What I forgot to say, some customers were running more than one instance of the application server. For example, there were some customers, that have running 6-8 WLS on a cluster of 3 machines. And additional they have installed also some other applications for testing purposes. I have to count all instances, that were running. So I need to know, if WLS for example is running at this machine, and if so, how many instances were installed/running actually.
If somebody is interested in my script, let me know, maybe I can post it here or somewhere else, so that you can take a look at. But I would like to know, if Iīm on the right way with my thoughts or if I should go another way that is more comfortable.
If you have questions, let me know!
Systems running : UNIX

SmilieSmilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to limit the number of running instances of a script?

I would like to allow only one instance of a script to run at any moment. I've tried the following solution to count the instances but the result is always the number of running instances plus one and I can't find the problem ps -ef | grep $0 | sed '/^$/ d' | sed '/grep/ d' | wc -l Please... (2 Replies)
Discussion started by: oti
2 Replies

2. Shell Programming and Scripting

Script that checks for previous instances running

Hello, I'm trying to write a script that checks for previous instances of the same script which may still be running (this script is scheduled to run every 30 minutes). I want to somehow use the pid from each instance to make sure the previous one isn't running before continuing with my... (5 Replies)
Discussion started by: bd_joy
5 Replies

3. AIX

multiple instances of same vg on same AIX machine

hi, i am new to AIX and to this forum as well. Can you please help me out with following issue/requirement 1) I have one physical volume (pv1) (a scsi disk). (pv1) on 1st AIX machine. I have a single volume group on it(vg1). 2)I removed it from the 1st AIX machine and exported to the 2nd... (1 Reply)
Discussion started by: navadeep
1 Replies

4. UNIX for Advanced & Expert Users

Running script on remote machine

if i have a script in my system which i need to run on remote system using ssh, how shall i do it? One easy way to to first scp it to remote machine and then run it on remote machine using ssh. Is there any one step way to do it. Preferably one in which i should give password only once (3 Replies)
Discussion started by: vickylife
3 Replies

5. Shell Programming and Scripting

running script in background on remote machine

Hi there I have a script which is running a remote command on hundreds of boxes, it takes around 5 minutes to return an output from this command and because i am running this all from a central box, it goes off to each box in my for loop sequentially meaning that my script will wait for output... (5 Replies)
Discussion started by: hcclnoodles
5 Replies

6. UNIX for Advanced & Expert Users

Script running on remote machine - How ??

Hi All, This was an interview question " There is a clean-up shell-script in one UNIX machine and it is connected to 100 other UNIX machines. Howe can we run the script on all the 100 machines without ftping/copying the script to target machines ? I was unable to answer, please answer if... (5 Replies)
Discussion started by: coolbhai
5 Replies

7. Shell Programming and Scripting

A script that kills previous instances of itself upon running not killing child processes

I'm likely going to explain this clumsily, so apologies in advance: I have the following script: #!/bin/bash pidPrefix="logGen" checkPrime () { if /sbin/ifconfig eth0:0|/bin/grep -wq inet;then isPrime=1;else isPrime=0;fi } killScript () { /usr/bin/find /var/run -name... (4 Replies)
Discussion started by: DeCoTwc
4 Replies

8. Shell Programming and Scripting

Counting Instances of a String with AWK

I have a list of URLs and I want to be able to count the number of instances of addresses ending in a certain TLD and output and sort it like so. 5 bdcc.com 48 zrtzr.com 49 rvo.com Input is as so ync.org sduzj.edu sduzj.edu sduzj.edu sduzj.edu sduzj.edu sduzj.edu sduzj.edu... (1 Reply)
Discussion started by: Pjstaab
1 Replies

9. OS X (Apple)

Quit a shell script thats running on a remote machine

I'm in a situation where I am executing a shell script(Bash) on another machine remotely using ssh, and for various reasons sometimes need to quit it and restart it. The shell script being run does many different things, so its hard to know what process to kill on the remote machine, and even if I... (2 Replies)
Discussion started by: TheDrizzle
2 Replies

10. Shell Programming and Scripting

Keep a script on remote machine running (nohup?)

Hi, I'm using expect to ssh into remote machine (i know its not the best practice), and run script "script.sh". This "script.sh" checks whether an other process (some another script) is running and if not, it runs it as some other user. #!/bin/bash /usr/bin/expect << EOD set... (5 Replies)
Discussion started by: oseri
5 Replies
libcurl(3)						      libcurl easy interface							libcurl(3)

NAME
libcurl-easy - easy interface overview DESCRIPTION
When using libcurl's "easy" interface you init your session and get a handle (often referred to as an "easy handle"), which you use as input to the easy interface functions you use. Use curl_easy_init(3) to get the handle. You continue by setting all the options you want in the upcoming transfer, the most important among them is the URL itself (you can't transfer anything without a specified URL as you may have figured out yourself). You might want to set some callbacks as well that will be called from the library when data is available etc. curl_easy_setopt(3) is used for all this. When all is setup, you tell libcurl to perform the transfer using curl_easy_perform(3). It will then do the entire operation and won't return until it is done (successfully or not). After the transfer has been made, you can set new options and make another transfer, or if you're done, cleanup the session by calling curl_easy_cleanup(3). If you want persistent connections, you don't cleanup immediately, but instead run ahead and perform other transfers using the same easy handle. libcurl 7.10.7 12 Aug 2003 libcurl(3)
All times are GMT -4. The time now is 05:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy