1748123 Members
3314 Online
108758 Solutions
New Discussion юеВ

Process Header

 
SOLVED
Go to solution
Jeff Machols
Esteemed Contributor

Process Header

Anyone know how to change or control the processes header that gets display on the ps command.

So when run /usr/local/bin/myscript

instead of the output of ps being

jeff 2939 9393 X X X /usr/local/bin/myscript

I want
jeff 2939 9393 X X X customized_description

Any ideas?
11 REPLIES 11
A. Clay Stephenson
Acclaimed Contributor

Re: Process Header

Hi Jeff:

This sort of thing is usually used by those who want to hide their tracks; I think I'll keep those ideas to myself.
If it ain't broke, I can fix that.
Christopher Caldwell
Honored Contributor

Re: Process Header

You can set the process title using C. I'm not aware of a mechanism to set the process title using shell commands. If you're interested in the C program, let me know and I'll post an example.
Craig Rants
Honored Contributor

Re: Process Header

OOOOh, directly out of Unix Hackers 101.
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
Jeff Machols
Esteemed Contributor

Re: Process Header

Thats what I thought Clay, but it's my boss that wants it. What does that mean!?!?! Let me rephrase, is there a straight forward, legimitiment, non-hack way to do this?
Jeff Machols
Esteemed Contributor

Re: Process Header

Actually what we want is a way to see whats at the end. The beginning of the command is just the path, we want to be able to do a ps and see the end of entire command
Jeff Machols
Esteemed Contributor

Re: Process Header

Chris,

I wouldn't mind looking at the C example. Thanks

Mark Greene_1
Honored Contributor

Re: Process Header

You'll have to wrap the command in a c program. Man pstat for more info, there are several freely available examples on the web.

--
mark
the future will be a lot like now, only later
Christopher Caldwell
Honored Contributor
Solution

Re: Process Header

 
Mark Greene_1
Honored Contributor

Re: Process Header

if all you are looking for is the full command-line, try this:

#!/bin/ksh
stty columms 132
ps -ef |fold

--
mark
the future will be a lot like now, only later