- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: ps -ef command count value problem from script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2011 06:50 AM
11-02-2011 06:50 AM
ps -ef command count value problem from script
Hi Experts,
I have below script to check process status of bpbkar process. The below $VALUE always returns 2 (or) 3 while executing the script, but when checking the command manually "ps -ef|grep bpbkar | grep -v grep | wc -l" on system, it returns 1. Can somebody help to fix the problem?
VALUE=`ps -ef|grep bpbkar | grep -v grep | wc -l`
echo $VALUE
if [ "$VALUE" -gt "1" ]
then
#echo "More than one instance of bpbkar process running"
fi
Output of commands:-
odxcdd01:/clocal/csclvl2/user/t1707rd $ ps -ef|grep bpbkar | grep -v grep |wc -l
1
odxcdd01:/clocal/csclvl2/user/t1707rd $ ps -ef|grep bpbkar | grep -v grep
root 565400 1 71 23:22:33 - 44:23 bpbkar -r 604800 -ru root -dt 0 -to 0 -clnt odxcdd01.oddc.chrysler.com -class ODD_CGN_FS_AIX -sched Full -st FULL -bpstart_to 300 -bpend_to 300 -read_to 300 -ckpt_time 900 -blks_per_buffer 128 -tir -tir_plus -use_otm -fso -b odxcdd01.oddc.chrysler.com_1320204152 -kl 14 -use_ofb
Thanks,
Ram.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2011 07:26 AM
11-02-2011 07:26 AM
Re: ps -ef command count value problem from script
Hi:
You don't know what your matching with any assurance -- process basenames, arguments to processes and/or processes whose names contain the string "bpbkar".
A much more rigorous way to match is to use the XPG4 (UNIX95) extension with HP-UX 'ps' thusly:
# VALUE=$(UNIX95= ps -C bpbkar -opid=|wc -l)
This sets the XPG4 (or 'UNIX95') behavior only for the duration of the command line since setting it can have side-effects for other commands that you may not want or know.
The command looks for a process or processes named "bpbkar" in this example and collects the PID value. THe normal 'ps' heading line is suppressed by using the "=" suffix.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2011 10:24 PM
11-02-2011 10:24 PM
Re: ps -ef command count value problem from script
>but when checking the command manually
Why not put those checking commands in your script to see what it says?
Does your script have bpbkar in its name?