- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- ps command in ksh script fails
Operating System - HP-UX
1748264
Members
3941
Online
108760
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
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
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
тАО12-18-2010 11:34 PM
тАО12-18-2010 11:34 PM
ps command in ksh script fails
For the life of me, I have no idea why this keeps failing, I have tried multiple different ways to get this to work. I run this as a test, no problem it works, as soon as I run in cron it fails with:
ps: option requires an argument -- u
usage: ps [ -aAdeflcjLPyZ ] [ -o format ] [ -t termlist ]
(( count=40 ))
while ((count -=1))
do
MQSTAT=`ps -ef |grep amqzxma0 |grep -v grep`
if [[ -z $MQSTAT ]]
then
break
fi
sleep 30
echo $MQSTAT >>$SSLOG
done
ps: option requires an argument -- u
usage: ps [ -aAdeflcjLPyZ ] [ -o format ] [ -t termlist ]
(( count=40 ))
while ((count -=1))
do
MQSTAT=`ps -ef |grep amqzxma0 |grep -v grep`
if [[ -z $MQSTAT ]]
then
break
fi
sleep 30
echo $MQSTAT >>$SSLOG
done
- Tags:
- PS
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2010 12:40 AM
тАО12-19-2010 12:40 AM
Re: ps command in ksh script fails
I just see "ps -ef", no -u at all.
You may want to add "set -x" to your shell script to see what is executing.
You may want to add "set -x" to your shell script to see what is executing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2010 02:46 PM
тАО12-19-2010 02:46 PM
Re: ps command in ksh script fails
> usage: ps [ -aAdeflcjLPyZ ] [ -o format ] [ -t termlist ]
This isn't an HP-UX ps option list. Are you running on HP-UX or are you using a non-standard ps.
Note that ps piped to grep will be full of problems because grep won't look in just one part of the line. -u is the user option in HP-UX so there is no need to use "grep something" or "grep -v grep" at all. Simply run the command:
ps -f -u someuser
ps will perform an exact match on the user field. This will show a title line even with no matches, so you can use the -o option to pick the fields you want to use:
UNIX95=1 ps -u someuser -o pid= -o ppid= -o ruser -o args
UNIX95=1 is required for HP-UX ps to use the -o option. NOTE: not much of this applies to non-HP-UX systems.
Bill Hassell, sysadmin
This isn't an HP-UX ps option list. Are you running on HP-UX or are you using a non-standard ps.
Note that ps piped to grep will be full of problems because grep won't look in just one part of the line. -u is the user option in HP-UX so there is no need to use "grep something" or "grep -v grep" at all. Simply run the command:
ps -f -u someuser
ps will perform an exact match on the user field. This will show a title line even with no matches, so you can use the -o option to pick the fields you want to use:
UNIX95=1 ps -u someuser -o pid= -o ppid= -o ruser -o args
UNIX95=1 is required for HP-UX ps to use the -o option. NOTE: not much of this applies to non-HP-UX systems.
Bill Hassell, sysadmin
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP