Prev: Ruby gem for Growl
Next: Plugin errors
From: 12345678 123456789 on 21 May 2010 09:55 Is there any way to set the application name or process name that appears in task manager for a program? -- Posted via http://www.ruby-forum.com/.
From: Rob Biedenharn on 21 May 2010 10:17 On May 21, 2010, at 9:55 AM, 12345678 123456789 wrote: > Is there any way to set the application name or process name that > appears in task manager for a program? > -- > Posted via http://www.ruby-forum.com/. > $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 Rob(a)AgileConsultingLLC.com http://gaslightsoftware.com rab(a)GaslightSoftware.com
From: TJ nonstickglue on 21 May 2010 10:26 Rob Biedenharn wrote: > On May 21, 2010, at 9:55 AM, 12345678 123456789 wrote: > >> Is there any way to set the application name or process name that >> appears in task manager for a program? >> -- >> Posted via http://www.ruby-forum.com/. >> > > > $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 > Rob(a)AgileConsultingLLC.com > http://gaslightsoftware.com > rab(a)GaslightSoftware.com Is there something I need to require at the beginning of my code because I tried this when I googled the answer and it doesn't work. I think that only applies to Ruby on Rails. Here are the first few lines of my code: $defout.sync=true require 'uri' require 'net/http' require 'FileUtils' require 'date' require 'yaml' $0 = "ProgramName" -- Posted via http://www.ruby-forum.com/.
From: Rob Biedenharn on 21 May 2010 10:48 On May 21, 2010, at 10:26 AM, TJ nonstickglue wrote: > Rob Biedenharn wrote: >> On May 21, 2010, at 9:55 AM, 12345678 123456789 wrote: >> >>> Is there any way to set the application name or process name that >>> appears in task manager for a program? >>> -- >>> Posted via http://www.ruby-forum.com/. >>> >> >> >> $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 >> Rob(a)AgileConsultingLLC.com >> http://gaslightsoftware.com >> rab(a)GaslightSoftware.com > > > Is there something I need to require at the beginning of my code > because > I tried this when I googled the answer and it doesn't work. I think > that > only applies to Ruby on Rails. > > Here are the first few lines of my code: > > $defout.sync=true > > require 'uri' > require 'net/http' > require 'FileUtils' > require 'date' > require 'yaml' > > $0 = "ProgramName" > -- > Posted via http://www.ruby-forum.com/. > Nothing special [ruby-1.8.6] :Users/rab $ ruby -e '$0="Here I am\0";sleep 60' & ps ww [1] 70676 PID TT STAT TIME COMMAND 62343 s000 S+ 0:00.28 -bash 70613 s001 S 0:00.12 -bash 70676 s001 R 0:00.00 Here I am But you do need to include the NUL at the end "\0" I believe. -Rob Rob Biedenharn http://agileconsultingllc.com Rob(a)AgileConsultingLLC.com http://gaslightsoftware.com rab(a)GaslightSoftware.com
From: Mark T on 23 May 2010 19:46
Should this survive a 1.8.7 fork? MarkT > [ruby-1.8.6] :Users/rab $ ruby -e '$0="Here I am\0";sleep 60' & ps ww > [1] 70676 >  PID  TT  STAT    TIME COMMAND > 62343 s000  S+   0:00.28 -bash > 70613 s001  S    0:00.12 -bash > 70676 s001  R    0:00.00 Here I am > > > But you do need to include the NUL at the end "\0" I believe. > -- (+61 4) 0679 5734 skype: govirtual.com.au ãã§ãã¯ã¢ã¦ãããJingle ã ! It's a Jingle Out There! |