Display workflow engine which are not running


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Display workflow engine which are not running
# 1  
Old 07-30-2009
Display workflow engine which are not running

Hi ,
We have 6 informatica workflow engine running on our server , so if we do a
ubnf0010% ps -ef |grep workflow |grep "TCPP01 TCPP01"
atlmsts 12721 1 0 06:52:18 ? 14:58 workflow TCPP01 TCPP01 1
atlmsts 14415 1 0 06:52:44 ? 14:56 workflow TCPP01 TCPP01 2
atlmsts 21876 1 0 06:54:07 ? 14:50 workflow TCPP01 TCPP01 5
atlmsts 19720 1 0 06:53:40 ? 15:02 workflow TCPP01 TCPP01 4
atlmsts 23736 1 0 06:54:25 ? 14:39 workflow TCPP01 TCPP01 6
atlmsts 17785 1 0 06:53:17 ? 14:53 workflow TCPP01 TCPP01 3

all 6 are shown running .
At times there is 1 or multiple engine failure, in that suppose 2 and 5 fails, when we do a
ubnf0010% ps -ef |grep workflow |grep "TCPP01 TCPP01"

atlmsts 12721 1 0 06:52:18 ? 14:58 workflow TCPP01 TCPP01 1
atlmsts 19720 1 0 06:53:40 ? 15:02 workflow TCPP01 TCPP01 4
atlmsts 23736 1 0 06:54:25 ? 14:39 workflow TCPP01 TCPP01 6
atlmsts 17785 1 0 06:53:17 ? 14:53 workflow TCPP01 TCPP01 3

I want a script which displays which engines(engine numbers are not running , if there are engine failure)
# 2  
Old 07-30-2009
You can do something like that :
Code:
ps -ef | \
awk -v count=6 '
$(NF-3)=="workflow" && $(NF-2)=="TCPP01" && $(NF-1)=="TCPP01" {
    ++p[$NF]
}
END {
   for (i=1; i<=count; i++) {
      if (! p[i])
         print "engine not running:",i
   }
}
'

Output:
Code:
engine not running: 2
engine not running: 5

Jean-Pierre.
# 3  
Old 07-30-2009
explain the logic

please explain this
ps -ef | \
awk -v count=6 '
$(NF-3)=="workflow" && $(NF-2)=="TCPP01" && $(NF-1)=="TCPP01" {
++p[$NF]
}
# 4  
Old 07-30-2009
Code:
 -v count=6

initialyze variable count which contains the numbers of engines.
Code:
$(NF-3)=="workflow" && $(NF-2)=="TCPP01" && $(NF-1)=="TCPP01" { ... }

Select records containing "workflow TCPP01 TCPP01" before last fiels (which is engine number).
NF is the totaal number of fields in the input record processed.
Code:
++p[$NF]

Increment the element for the engine ($NF is last fied) in the p array
Code:
END { ... }

When all input record have been processed
Code:
   for (i=1; i<=count; i++) { ... }

I is the engine, number
Code:
      if (! p[i])
         print "engine not running:",i

If the element for the engine in the p array is 0 (not different of zero) the print message.


Jean-Pierre.
# 5  
Old 07-30-2009
it gives me a syntax error

awk: syntax error near line 1
awk: bailing out near line 1
# 6  
Old 07-30-2009
Use gawk instead of awk (on my system it's the same thing).
This solutions works only with gawk because the time functions aren't defined with other versions of awk.


Jean-Pierre.
# 7  
Old 07-30-2009
gawk is not installed on the server

---------- Post updated at 07:07 PM ---------- Previous update was at 06:55 PM ----------

is there any other solution without gawk
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to display processes which have been running for more than a X hours?

Hi, Is it possible to display processes which have been running for more than a 5hrs using a variation of the ps -ef command? Regards, Manny (5 Replies)
Discussion started by: mantas44
5 Replies

2. UNIX for Beginners Questions & Answers

How to display only the first 5 running process using top in shell scripting?

topfunc() { top } topfunc Here i used the top command inside a function,and i called the function. when executing this bash file i get all the process which are using by the kernel i just want to display only the first 5 running process. is it possible? (7 Replies)
Discussion started by: Meeran Rizvi
7 Replies

3. Shell Programming and Scripting

Display current directory for a running process for script

I'm trying to create a ksh script to do the following: 1) Ask the user what process they want to search for. 2) Have the script read the input as a variable and use it to search for the process. 3) Display the current time & date, the working directory of the process, and finally display the... (6 Replies)
Discussion started by: seekryts15
6 Replies

4. Shell Programming and Scripting

How to display information of the script while its running?

how to display the messages on screen IN PERL such as " 1. Entering while loop" if the script enters a while loop. 2. Checking FILENAME. etc... 3. Print statement is also not helpful.... (1 Reply)
Discussion started by: Rashid Khan
1 Replies

5. UNIX for Dummies Questions & Answers

Display problem when running a remote script

Hi, Quick question, someone will hopefully be able to stop me from :wall:. I currently have a script which calls a script on a remote machine and captures the stdout to a file: ssh <user>@<server> > output 2>/dev/null <<_EOF /path/script.ksh _EOF This runs the script but the... (4 Replies)
Discussion started by: chris01010
4 Replies

6. UNIX for Dummies Questions & Answers

Display full command (including options) information in running

Suppose I am a Unix user, not a root. I can see all commands in running by ps -elf, or some similar commands. Such commands may be submit by other Unix users. Is there a way that I can display those commands with their full parameters/options. For example, I can see a user is running "ls"... (3 Replies)
Discussion started by: happy_lotus
3 Replies

7. Windows & DOS: Issues & Discussions

Display running 'app' in terminal titlebar?

Hi. I was, not too long ago, an OS X home user. One of the things I remember from using the Apple-installed Terminal is: whenever an executable that took more than a split second to do its thing was running, its name would appear in the title bar in a way similar to "Terminal: ssh" or "Terminal:... (0 Replies)
Discussion started by: SilversleevesX
0 Replies

8. Shell Programming and Scripting

display time required to complete running script

hi is there any way i can display a countdown time needed to run a script? like load a counter at the beginning of the script with the estimated time and display the counter decrementing till it finishes running the script? (3 Replies)
Discussion started by: npatwardhan
3 Replies

9. AIX

CDE running but not display on screen

Runing p550Q via HMC I'd like to start using graphic interface CDE: lslpp -l | grep X11.Dt* X11.Dt.ToolTalk -- AIX CDE ToolTalk Support X11.Dt.bitmaps -- AIX CDE Bitmaps X11.Dt.helpmin -- AIX CDE Minimum Help Files X11.Dt.helprun -- AIX CDE Runtime Help X11.Dt.lib -- AIX CDE... (0 Replies)
Discussion started by: silves
0 Replies

10. UNIX for Advanced & Expert Users

Display program running on CDE via GNOME

Hi All, I have one AIX box (5.1 with CDE running) and one Linux box ( FC3 with GNOME on it). What I want to be able to do is : SSH from the Linux box into the AIX box and then open an X term to launch a X window application. I am not able to do that. My guess is that the window mangers and... (4 Replies)
Discussion started by: navinxavier
4 Replies
Login or Register to Ask a Question