Application Name / Process Name

1

12345678 123456789

Is there any way to set the application name or process name that
appears in task manager for a program?
 
R

Rob Biedenharn

Is there any way to set the application name or process name that
appears in task manager for a program?


$0 = "This is my program\0"

But you might have trouble if you want to set the name to something
longer than the original program + args. (I.e., $0.length

You can also run into trouble if a process monitor (e.g., monit) is
relying on the process name.

-Rob

Rob Biedenharn
http://agileconsultingllc.com
(e-mail address removed)
http://gaslightsoftware.com
(e-mail address removed)
 
M

Mark T

Should this survive a 1.8.7 fork?

MarkT
[ruby-1.8.6] :Users/rab $ ruby -e '$0=3D"Here I am\0";sleep 60' & ps ww
[1] 70676
=C2=A0PID =C2=A0 TT =C2=A0STAT =C2=A0 =C2=A0 =C2=A0TIME COMMAND
62343 s000 =C2=A0S+ =C2=A0 =C2=A0 0:00.28 -bash
70613 s001 =C2=A0S =C2=A0 =C2=A0 =C2=A00:00.12 -bash
70676 s001 =C2=A0R =C2=A0 =C2=A0 =C2=A00:00.00 Here I am


But you do need to include the NUL at the end "\0" I believe.
--=20
(+61 4) 0679 5734
skype: govirtual.com.au
=E3=83=81=E3=82=A7=E3=83=83=E3=82=AF=E3=82=A2=E3=82=A6=E3=83=88=E3=81=8C=E3=
=80=81Jingle =E3=81=A0!
It's a Jingle Out There!
 
M

Mark T

Looks like it does with one-liner.
ruby -e '$0="Here I am\0";puts Kernel::fork;sleep 60' & ps ww

Must be a keyboard thing here...

MarkT

Should this survive a 1.8.7 fork?

MarkT
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top