I would like to change the name of the ruby process that gets displayed in the linux/unix top command. I have tried the
$0=\'miname\'
approach
I don't think Ruby has the facility builtin (setproctitle(3)
). You should probably try to look at ruby-ffi and create the interface to setproctitle(3)
.
EDIT: I know you have your answer but I want to show you some code to use ffi:
require "ffi"
#
module LibC
extend FFI::Library
attach_function :setproctitle, [:string, :varargs], :void
end
LibC.setproctitle("Ruby: executing %s", :string, $0)
Does not work on OS X because setproctitle(3)
does not exist, works on FreeBSD.