lib/process/daemon.rb in process-daemon-0.5.3 vs lib/process/daemon.rb in process-daemon-0.5.4
- old
+ new
@@ -131,10 +131,26 @@
def shutdown
# Interrupt all children processes, preferably to stop them so that they are not left behind.
Process.kill(:INT, 0)
end
+ attr :title
+
+ # Set the process title - only works after daemon has forked.
+ def title= title
+ @title = title
+
+ if Process.respond_to? :setproctitle
+ Process.setproctitle(@title)
+ else
+ $0 = @title
+ end
+ end
+
def run
+
+ self.title = self.name
+
trap("INT") do
shutdown
end
startup