Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I understand it displays the command with arguments, or when unavailable the command in square brackets.

But where do the names come from for processes such as passenger worker ruby instances, which show up as:

root@XXX:~# ps aux | grep Rails
webuser    2273  0.0  3.2  86968 57500 ?        S    17:38   0:00 Rails: /var/websites/app

...and how can I launch processes and set such a string?

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

I believe it is done via the setproctitle function.

 #include <sys/types.h>
 #include <unistd.h>
 void
 setproctitle(const char *fmt, ...);

 The setproctitle() library routine sets the process title that appears on
 the ps(1) command.

For Ruby specifically, there is a stackoverflow post about doing this without third party libraries.

share|improve this answer
add comment

Usually you need to change argv directly, here's an example: http://stupefydeveloper.blogspot.com/2008/10/linux-change-process-name.html

share|improve this answer
    
Thanks a lot for the answer –  jberryman Jun 3 '11 at 19:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.