Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
cancel
Showing results for 
Search instead for 
Did you mean: 

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
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
Christopher Caldwell
Honored Contributor

Re: Process Header

 
Mark Greene_1
Honored Contributor

Re: Process Header

well, if we are posting code on this, try these code snippets out:

main (int argc, char **argv)
{
int i;
strcpy(argv[0], "ls"); /* pretend we are 'ls' instead */
if (argc>1)
for (i=1; i strcpy(argv[i],"");
dosomething();
exit(x);
}

/* this program shows its progress, using argv[1]
*/
main (int argc, char **argv)
{
while ((current_filename = getfilename()) != NULL)
{
strcpy(argv[1], current_filename);
process_file(current_filename);
} exit(x);
}
the future will be a lot like now, only later