ps-eo returning wrong value

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat ps-eo returning wrong value
# 1  
Old 12-04-2009
ps-eo returning wrong value

Hi
Need some help, bit of a noobie here.

This command work perfectly with unix. returns a value of 1 which is what i want.
ps -eo user,comm |grep -v grep |grep -c /path to file

When i run the same command on a linux server it returns a value of 0.,
something maybe wrong with the command. The process im looking for is definately running. Just returns a value of 0

someone please help


# 2  
Old 12-04-2009
I don't know which flavor of unix you are used to using so I can't give you a direct translation. Switches for the various standard unix/linux commands vary between distributions. Check the man pages for the command to find the switch that provides the output you are looking for.
Padow
# 3  
Old 12-04-2009
Try this one.
ps -eo user,comm |grep -v grep |grep -c filename

e.g:
Code:
ps -eo user,comm |grep -v grep |grep -c sshd

# 4  
Old 12-28-2009
It's possible that the options that you're trying to use are from the BSD version of ps. If that's the case, you may be able to try using it without the '-' in front of the 'eo' options and see if that provides the output you're expecting.

As per the ps man page:

This version of ps accepts several kinds of options:
1 UNIX options, which may be grouped and must be preceded by a dash.
2 BSD options, which may be grouped and must not be used with a dash.
3 GNU long options, which are preceded by two dashes.


Hope this helps!
# 5  
Old 12-28-2009
I think you need to use:
Code:
ps -eo user,args

instead.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. What is on Your Mind?

Returning to the forum

hey guys, Im back! I hadnt thought about yall in a long time. I was googling away this morning and found a solution I needed from unix.com. good to see yall are still here and going strong! Im working as a Bladelogic Automation Engineer and have been doing HP and BMC server automation... (0 Replies)
Discussion started by: Kelam_Magnus
0 Replies

2. UNIX for Dummies Questions & Answers

Not returning from a sub script?

My problem in brief is that I execute a script from another script and I can not pick up the return code from that script, or otherwise I am not returning from that script. I have an echo in the executed script and we get a response code of 0 and exit that script with the return code. I then try to... (1 Reply)
Discussion started by: Charles Swart
1 Replies

3. Shell Programming and Scripting

Why result is wrong here ? whether break statement is wrong ?

Hi ! all I am just trying to check range in my datafile pls tell me why its resulting wrong admin@IEEE:~/Desktop$ cat test.txt 0 28.4 5 28.4 10 28.4 15 28.5 20 28.5 25 28.6 30 28.6 35 28.7 40 28.7 45 28.7 50 28.8 55 28.8 60 28.8 65 28.1... (2 Replies)
Discussion started by: Akshay Hegde
2 Replies

4. Shell Programming and Scripting

Returning to menu

i have my script all setup but what i was wanting to know is, after a choice has been made on the menu and it completes, what command can i type in to return to the menu of the script. with my script, when a command is finished, it just asks me to input my choice but it doesn't show the menu. any... (3 Replies)
Discussion started by: hotshot247
3 Replies

5. Shell Programming and Scripting

Script returning 0

hello i write a script which calculate free space but he always is 0 thats wrong with my script? getFileSystemPerformanceData() { if ; then if grep -q "Ubuntu" /etc/issue ; then CMD="df -lP | grep -v "\/home" | grep -v "\/dev/mapper/VolGroup-lv_root"" elif grep... (5 Replies)
Discussion started by: donatas1234
5 Replies

6. Shell Programming and Scripting

Returning -ve value in a pattern

Dear Friends, I need your help once more. I want to write a simple select as follows select amount from books where sr=1234 However, if value of "Amount" is negative then it should print it as follows. "3000-" and not as "-3000" Can you help me in this? Waiting for reply Anu. (2 Replies)
Discussion started by: anushree.a
2 Replies

7. Shell Programming and Scripting

Returning the name of function used

Hi All In my script, I can call on several functions. I have a logging function that is called by any of these functions. What I would like is some way of identifying which function I am using and pass this to the log function as some parameter. Is there some built in command or way of... (3 Replies)
Discussion started by: kingpin2502
3 Replies

8. Shell Programming and Scripting

returning from a function

Hi all, I am very new to BASH shell programming. I need to return an integer from a function to the caller function. I did this: but it keeps giving me wrong return: Can someone help me out here, please? Thanks (2 Replies)
Discussion started by: alirezan
2 Replies

9. UNIX for Advanced & Expert Users

pclose returning -1

Hi all, In my application i am trying to select some text & then give it to print. for this i am opening a stream using popen & then later closing using pclose. Now this is working fine in my environment (solaris) but the pclose function is failing at my clients m/c. Even though print is... (3 Replies)
Discussion started by: nimishm123
3 Replies

10. Shell Programming and Scripting

returning value from sqlplus

Hi, I need to return one value from sqlplus to UNIX environment. Can anyone give me an example? i.e. select username from v$session where sid=15; This query will return username value which I require in UNIX after exiting from sqlplus. Malay (1 Reply)
Discussion started by: malaymaru
1 Replies
Login or Register to Ask a Question