ps -eaf gives inconsistent result


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ps -eaf gives inconsistent result
# 1  
Old 04-28-2011
ps -eaf gives inconsistent result

The command ps -eaf gives inconsistent result when executed on XYZ server (the command shows 1, 2 or 3 instances of the process. Ideally it should show only 1). I have attached the script file that was executed and the corresponding output. When the same script was executed on ABC server it gave the desired result.

XYZ : Is a VM instance running Linux (Red Hat Enterprise Linux Server release 5.5 (Tikanga))
ABC : Physical server running Linux (Red Hat Enterprise Linux AS release 4 (Nahant Update 7))

I would like to know that XYZ being a VM instance are there any environmental settings or issues which might result in such a behavior? Any inputs on this are appreciated.

Thanks!!
# 2  
Old 04-29-2011
I dont think the reason for this due to different o.s. actually it can be differ for when used in different shells or shell versions.
Try `which ksh` and compare version of kshs.
In your script, has used pipes. Maybe because of this, cause get different output in debug mode when in some kshs,
it writes as output it with unordered in ksh own internal buffer which probably caughted first command writes firstly it and after then others in pipes commas.

You can try to look output of ksh debug , add `sleep 1` your script after the `ps ..` command.

regards
ygemici
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Inconsistent results using sort function

Could you please advise on the following: I have two space-delimited files with 9 and 10 columns, respectively, with exactly the same values in column 1. However, the order of column 1 differs between the two files, so I want to sort both files by column 1, so that I can align them and... (6 Replies)
Discussion started by: aberg
6 Replies

2. UNIX for Advanced & Expert Users

Inconsistent disk information.

On one of the Unix server B.11.31. a disk that has been provisioned from the VMAX, but according to the diskinfo its show coming from clarion. sudo /opt/emc/SYMCLI/bin/symvg sho /dev/vg_<name> Volume Group Name : /dev/vg_<name> Volume Group Type : HP-UX LVM Volume Group State ... (0 Replies)
Discussion started by: kpatel786
0 Replies

3. Shell Programming and Scripting

How to compare the current result with previous line result.?

Hi Gurus, I have requirement to compare current result with previous reuslt. The sample case is below. 1 job1 1 1 job2 2 1 job3 3 2 job_a1 1 2 job_a2 2 2 job_a3 3 3 job_b1 1 3 job_b2 2 for above sample file, GID is group ID, for input line, the job run... (1 Reply)
Discussion started by: ken6503
1 Replies

4. UNIX for Advanced & Expert Users

Iostat inconsistent avgrq-sz

Hi Experts, I have an issue with performance of oracle, the db sits on EBS volumes on and aws EC2 instance. I have captured the iostat data and feed it to iostat_plotter to forward it to the DB administrators. However what I'm trying to understand is the variable avgrq-sz, it is quite in... (0 Replies)
Discussion started by: maverick_here
0 Replies

5. Shell Programming and Scripting

Inconsistent `ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l`

i have this line of code that looks for the same file if it is currently running and returns the count. `ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l` basically it is assigned to a variable ISRUNNING=`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh |... (6 Replies)
Discussion started by: wtolentino
6 Replies

6. Shell Programming and Scripting

Inconsistent column printing

Hi, I have a file that has inconsistently numbered columns. Like row1 has 23 columns, and row 2 has 34 columns etc. I would like to re-order the first 8 columns as required and from the 9th column till the end, I would like to print it as it is. I tried to read the re-ordered 8 columns... (7 Replies)
Discussion started by: jacobs.smith
7 Replies

7. Shell Programming and Scripting

inconsistent output using date()

I have an input list of: I am just trying to turn this list into its seconds since epoch "+%s" time equivalent. I'm trying to use the following, but every time I run the command it gives me different answers, they are close, but never the same... any clues as to why? xargs -I{} date -j -f... (3 Replies)
Discussion started by: mdlloyd7
3 Replies

8. UNIX for Advanced & Expert Users

inconsistent cat output

Hi I'm executing a menu script in which I `cat a file` but it's giving different output some times. Following is the code fragment taken from my script. while true do cat procs.configured echo ---------separator-------------- sleep 3 done when I execute this code fragment, `cat` outputs... (2 Replies)
Discussion started by: axes
2 Replies

9. Shell Programming and Scripting

Inconsistent variable assignment issue

I am using a piece of code which is working fine in some cases and is not working in some other instances. All I am doing is grep'ing and concatenating. Below is a working scenario. $ echo $var1 REPLYFILENAME=Options_NSE1.txt.enc $ FILE_NM=`echo ${var1##*=}`.gz (Take everything after... (1 Reply)
Discussion started by: jamjam10k
1 Replies

10. HP-UX

Why are these inconsistent?

Hi I am using HP - UX... When I execute the below commands I get these results... Why do i get a different shell value when i run echo $SHELL? # echo $0 ksh # echo $SHELL sh # ps -p$$ PID TTY TIME COMMAND 4013 pts/7 0:00 ksh (2 Replies)
Discussion started by: gurubarancse
2 Replies
Login or Register to Ask a Question