Visit Our UNIX and Linux User Community

Keepalive issue

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Keepalive issue
# 1  
Old 01-11-2012
Keepalive issue


I am a c# developer and new to linux/unix environment after the prev developer resigned and is expected to swim but I am drowning SmilieSmilie

My problem is with keepalive. Currently there are 90+ nodes/jobs that run under keepalive. I managed to get code that shows me the count of these nodes/jobs that are running under keepalive viz.
ps -eaf | grep -w "sh" | grep -v grep | grep -v $$ | wc -l

This command is excecuted every 5 minutes to make sure that the number of jobs/nodes under keepalive stay consistant. Now the bossman Smilie wants to know the name of the jobs/nodes that at anytime no longer run under keepalive. The logic is at follows:

step 1: get all the jobs/nodes running under keepalive in the morning (isit keepalive Smilie)
step 2: monitor the count of jobs/nodes running under keepalive (have this Smilie)
step 3: if the count (step 2) change record the names of the jobs/nodes that is no longer in keepalive into a file Smilie

Please help. Thanx.

Moderator's Comments:
Mod Comment Use code tags, thanks.

Last edited by zaxxon; 01-11-2012 at 10:22 AM.. Reason: code tags
# 2  
Old 01-11-2012
have a look at man diff, diff may help to check for differences in files, line by line.

On the other hand, if you post a couple of example output files from the above checks and the desired output someone may give you more specific directions.
see ya
This User Gave Thanks to frappa For This Post:
# 3  
Old 01-11-2012
Sorry, the code should be

ps -eaf | grep -w "/" | grep -v grep | grep -v $$ | wc -l

The result of this command is a three digit number like the keepalivecount.gif thats attached.

I need a command that will check if a certain .sh file is still running under the keepalive monitoring.

Example :

$ newmq.cfg risk_engine_mqin 60

This says that the keepalive process will check every 60 seconds if the process/jobs/node "risk_engine_mqin", that is part of the newmq.cfg configuration, is running. If not, it will be started.

It happens from time to time that the server gives a problem such as permissions or space etc and that causes certain process/jobs/nodes or even the keepalive process itself to fail.

I need code to give me a list of all the process/jobs/node that is managed by keepalive so that I can compare the list if the count starts to go down in order to identify the problematic process/jobs/node.

Hope this makes more sense.

Originally Posted by frappa
have a look at man diff, diff may help to check for differences in files, line by line.

On the other hand, if you post a couple of example output files from the above checks and the desired output someone may give you more specific directions.
see ya
Keepalive issue-keepalivecountgif
# 4  
Old 01-11-2012
Hi, in the
ps -eaf ...

that you showed before, if you try to delete the last redirection (that is, "| wc -l") it will list all the processes containing in their command definition, plus many other infos.

also, if you replace "wc -l" with:
awk ' { print $NF } '

you will see a list of processes only.

You may start from there to write instructions to address the issue.

see ya
# 5  
Old 01-12-2012
solved !

thanx Frappa !

Previous Thread | Next Thread
Test Your Knowledge in Computers #404
Difficulty: Easy
Cygwin provides native integration of Windows-based applications, data, and other system resources with applications, software tools, and data of the Unix-like environment.
True or False?

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

What could be the issue ?

Hi, when i am trying below script assume that below values are taken in code #!/bin/ksh if then echo usage: QMGR NAME MQREQ fi NL=`echo 'dis qmgr'|runmqsc $1|grep REPOSNL|sed 's/.*REPOSNL\(.*\).*/\1/' |cut -d'(' -f2|cut -d')' -f1` echo 'define nl('$NL_$2')... (25 Replies)
Discussion started by: darling
25 Replies

2. Shell Programming and Scripting

Variable value substitution issue with awk command issue

Hi All, I am using the below script which has awk command, but it is not returing the expected result. can some pls help me to correct the command. The below script sample.ksh should give the result if the value of last 4 digits in the variable NM matches with the variable value DAT. The... (7 Replies)
Discussion started by: G.K.K
7 Replies

3. Shell Programming and Scripting

Need assistance with a file issue and a terminal issue

Hello everyone, I'm in need of some assistance. I'm currently enrolled in an introductory UNIX shell programming course and, well halfway through the semester, we are receiving our first actual assignment. I've somewhat realized now that I've fallen behind, and I'm working to get caught up, but for... (1 Reply)
Discussion started by: MrMagoo22
1 Replies

4. UNIX for Dummies Questions & Answers


In LINUX(CentOS, RedHat) is there a way to have the banner statement appear before the logon instead of after the logon? In UNIX and Windows the banner appears before a person actually logs on, what I'm seeing in LINUX is that it appears after the login(ftp, telnet, SSH). Thanks (0 Replies)
Discussion started by: ejjones
0 Replies

5. Shell Programming and Scripting

hi all please help me in this issue.

Hi all, I am very new to shell scripting.I have the requirement like one program is there, if it is running leave like that only and if it is stopped it has to be restart and once again keep watching and it is stopped we a have to restart once agian.I want a shell script for this.Please help me... (10 Replies)
Discussion started by: bhas85
10 Replies

6. UNIX for Dummies Questions & Answers

Putty KeepAlive command

Could anyone pls tell me what's the Putty KeepAlive command, use to prevent the putty disconnected from server.thanks (8 Replies)
Discussion started by: dannyd_y
8 Replies

7. Shell Programming and Scripting

Unix Arithmatic operation issue , datatype issue

Hi, I have a shell scripting. This will take 7 digit number in each line and add 7 digit number with next subsequent lines ( normal addition ). Eg: 0000001 0000220 0001235 0000022 0000023 ........... ......... ........ Like this i am having around 1500000 records. After adding... (23 Replies)
Discussion started by: thambi
23 Replies

8. Solaris

How can i Configure TCP Keepalive on sun solaris 9 machine?

I've installed sun solaris 9 and i need to know how can i enable TCP Keepalive to ping socket connections every 300 seconds? Thanks, Mohammed Amin (1 Reply)
Discussion started by: m_amin
1 Replies

9. UNIX for Dummies Questions & Answers

ps issue

HI All, Suddenly don't know what happened to redhat linux 7.2 any program start then itsn't listing while using ps -ef ex: ./xyz this xyz program pid not showing in ps-ef Pls let me know what is the reason for the same. Thanks a lot in advance Bache (7 Replies)
Discussion started by: bache_gowda
7 Replies

Featured Tech Videos