1833694 Members
3718 Online
110062 Solutions
New Discussion

ps question

 
Alex Lavrov
Regular Advisor

ps question

Hello,
I'm trying to monitor my oc4j process with ps command. But the monitor (not written by me, and I can't change it) uses ps -ef command, so not all line is shown and it can't see "oc4j" string at the end. The solution is to use ps -efx command. Is there any way to make ps -ef execute with x option?
6 REPLIES 6
Pete Randall
Outstanding Contributor

Re: ps question

Alex,

The command "ps -efx" works for me. Are you getting some sort of error or is the output not what you expect?


Pete

Pete
G. Vrijhoeven
Honored Contributor

Re: ps question

Hi,

Not sure what you want but you like to replace the ps -ef command used by a monitoring script into ps -efx. I say change the monitoring script. If you are not allowed to change the script, you can replace /usr/bin/ps with a script that calls the real ps and if -ef are provided autochange -ef in efx.
mv /usr/bin/ps /usr/bin/realps
and create a script called ps like this.
#!/usr/bin/ks
VARS=$1
if [ $VARS -eq "-ef" ]
then
/usr/bin/realps -efx
else
/usr/bin/realps $VARS
fi

But i think it is better to change the monitoring script.

HTH,

Gideon
RAC_1
Honored Contributor

Re: ps question

export UNIX95=1

ps -efx
There is no substitute to HARDWORK
Mark Grant
Honored Contributor

Re: ps question

The only way that immediately comes to my mind is to move "ps" to a new name e.g ps.orig and create a script called "ps" which looks a bit like this.

#!/usr/bin/sh
[ $1 = "-ef" ] && EXTRA="x"
ps.orig ${1}$EXTRA

I though an alias would work but I can't seem to make that work.

If you only want to do this for the user that this appliaction runs as, rather than renaming "ps" you could precede the users PATH with a directory containing your script and the script would use the full path to "ps". This means all other users would still use the origianl "ps"
Never preceed any demonstration with anything more predictive than "watch this"
Alex Lavrov
Regular Advisor

Re: ps question

ps -efx works fine, it's not the issue.
The problem is that the monitor uses ps -ef.
I thought about changing the original ps, but I really prefer not to do this.
Well, I guess the only option I have is to change the original monitor ...

Thanx all for the help!
Jean-Luc Oudart
Honored Contributor

Re: ps question

In the mean time, you can create your own script (as one example above) in say /usr/local/bin
before you run the monitor, change the PATH to be :
export PATH=/usr/local/bin:$PATH
this will run the "alternate" ps command.

Regards,
Jean-Luc
fiat lux