search for: service_main

Displaying 17 results from an estimated 17 matches for "service_main".

2007 Nov 24
5
Service.start arguments failing or causing segfault
Hi, Unless I''m mistaken the final arguments to Service.start should be passed to the Daemon''s service_main method. Correct? I modified the Service.start method (now in CVS) to look something like this: def self.start(service, host=nil, *args) ... num_args = args.length if args.empty? args = nil else args.unshift(service) # Necessary? args = [args.join("\000&...
2006 Dec 07
0
Fwd: win32-service problems with patch
...viceCtrl stuff (SCM will be waiting). I may change this so that START_PENDINGs are sent while in service_init, but because that greatly complicated matters, and I was just trying to get something that WORKED first, the current code does not do this. * now the service terminates if service_init or service_main exit or raise exceptions. Problems I encountered or resolved: * Waiting for the ThreadGroup is not sufficient to make sure ALL threads have exited. Instead, I wait on Thread.list to == 1. I don''t know that this was really necessary. * raising exceptions in service_init and service_mai...
2006 Feb 20
0
Win32 service and blocking code in service_main
Hello mailing list! Sorry for the personal/private mail I sent to Daniel and Park, but just a few minutes ago I subscribed to this list. I have found the solution, for webrick, mongrel and other webserver (well I guess). If the code in service_main is blocked (like the webrick dispatcher), the service_main function never exit/left, so service.mainloop never terminates and service control timeout. What I have done is put the running dispatcher in a Thread that is fired by service_main, and then I loop (like you have said Park) using small sle...
2007 Aug 07
0
[ win32utils-Bugs-12881 ] Cannot wait on Process - service_daemon/service_main
...pond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=12881&group_id=85 Category: win32-service Group: None Status: Open Resolution: None Priority: 3 Submitted By: John Leake (ozwaldtwistle) Assigned to: Nobody (None) Summary: Cannot wait on Process - service_daemon/service_main Initial Comment: First of all a warm thank you to all contributors of this excellent library. Windows XP Pro SP2 Ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32] Service 0.5.2 Process 0.5.3 I am using code based on the examples tdaemon.rb and tdaemon_ctl.rb Within tdaemon.rb/service_main() I...
2004 Apr 09
2
Issues with win32-service Daemon
...for a while, then just quits for no reason that I can see. The Event Log merely says, "The Abba service terminated unexpectedly". Any ideas on either issue? Dan # myservice.rb require "socket" require "win32/service" include Win32 class MyDaemon < Daemon def service_main File.open("c:\\test.log","a+"){ |f| f.puts("service_main entered") } s = TCPServer.new(8888) while socket = s.accept rv = socket.gets.chomp File.open("c:\\test.log","a+"){ |f| f.puts "GOT: #{rv}" } socket.puts "Thanks!&...
2011 Aug 29
0
Fwd: [win32-service] win32 daemon error - Service_Main thread exited abnormally (#4)
Any suggestions? ---------- Forwarded message ---------- From: 2potatocakes <reply+i-1463859-6ae63452bd734578892fcf4b571ee941f465e643 at reply.github.com> Date: Mon, Aug 29, 2011 at 12:40 AM Subject: Re: [win32-service] win32 daemon error - Service_Main thread exited abnormally (#4) To: djberg96 at gmail.com Thanks for looking at this guys. Have updated the strcpy line.. I''m still having problems though.. I''m pretty sure it''s coming from the 2 lines: dispatch_table = [""].pack(''p'') + [svc_...
2006 May 22
9
win32/service... still with problems.
...ed is the simplest service script I could do with ruby, which depends on win32/service. I found that doing anything complex in service_stop (killing threads, doing file handling, even sleeping for 0.25 seconds). crash the service with backtraces (of the service) like this: dead_service.rb:119:in `service_main'': uninitialized constant RUNNING (NameError) from U:/Programming/Sources/ruby/try/dead_service.rb:131 Just commenting the sleep command solves that problem, but leaves other issues there... like the impossible task of killing running threads (from a ThreadGroup, as example). Also, remov...
2005 Nov 26
1
Another patch of win32-service for nice startup.
...trcpy(error,ErrorDescription(GetLastError())); + ErrorStopService(); + rb_raise(cDaemonError,error); + } + + if(rb_respond_to(self,rb_intern("service_init"))){ + rb_funcall(self,rb_intern("service_init"),0); } + SetEvent(hStartEvent); + // Call service_main method if(rb_respond_to(self,rb_intern("service_main"))){ rb_funcall(self,rb_intern("service_main"),0); ======================================================== I tested with the code of 400 seconds initialization and work fine. def service_init for i in 1...
2005 Dec 01
1
service_cli.rb
...me to do away with a Riki-specific control script. So I can just do: riki.rb: ---- $LOAD_PATH.unshift File.dirname(__FILE__) require ''service_cli'' class RikiDaemon < Win32::Daemon def self.setup(s) s.binary_path_name = "ruby #{__FILE__} --service" end ...service_main/service_stop... end service_cli(''Riki'', RikiDaemon) ---- So now the "control" and "daemon" functions are both handled from the same generic script (I added an odd but effective command line parameter of --service which means its getting started by win32 and...
2005 Sep 08
11
Stopping services
...p'': An exception occurred in the service when handling the control request. (Win32::ServiceError) from script/service:77 from script/service:76:in `call'' from script/service:88 Note that I only get this if the service has successfully made it in to service_main - if I stop it before that, it stops OK. I wanted to back up and see if the examples worked OK for me, so I ran daemon_test: C:\build\ruby\extensions\win32-service-0.4.6\examples>ruby daemon_test.rb install VERSION: 0.4.6 installed C:\build\ruby\extensions\win32-service-0.4.6\examples...
2006 Jun 18
7
[Fwd: Ruby Win32-Service]
Thoughts? Dan -------------- next part -------------- An embedded message was scrubbed... From: "Patrick Hurley" <phurley at gmail.com> Subject: Ruby Win32-Service Date: Sun, 18 Jun 2006 12:46:01 -0400 Size: 2863 Url: http://rubyforge.org/pipermail/win32utils-devel/attachments/20060618/cc346796/attachment.eml
2005 May 14
4
Problems with custom service and webrick
...brickctl.rb # webrick_daemon.rb require "win32/service" include Win32 class WebrickDaemon < Daemon def initialize @log = "C:\\log.txt" end def service_start File.open(@log,"a+"){ |fh| fh.puts "Service started" } end def service_main while state == RUNNING File.open(@log, "a+"){ |fh| fh.puts "Service running" } sleep 5 end end def service_stop File.open(@log, "a+"){ |fh| fh.puts "Service stopped" } exit end end web_daemon = WebrickDa...
2006 May 14
6
Broken win32 service support for lastest mongrels.
Ok, this might sound bad... well, actually it is. I''m my rewrite of mongrel_rails_service and provide a uniform set of commands in the line of gem_plugin commands, found a few issues while stopping the service. Thinking that rails (1.1.2) was responsable, tested against my 1.0.0 rails app, both with the same results. Again, reverted to mongrel 0.3.8, when services was working ok, with
2006 Oct 26
2
The win32-service patch is committed - and now, some questions
...irectory. There''s now a tdaemon.rb (the test daemon) and tdaemon_ctl.rb (the test daemon controller). Before I release this into the wild I want to make sure I document how to use it properly. Based on what I experienced it now looks like users will need to put this snippet in their service_main: # You will see this line in tdaemon.rb while state == RUNNING || state == PAUSED || state == 0 # Do stuff end If I remove the ''|| state == 0'' portion, I still experience deadlock while trying to stop the service. I assume the 0 is the IDLE_CONTROL_CODE value that Patrick...
2004 Feb 06
0
Daemon method name changes
...oks in the Daemon class. However, I think I will change those to "service_stop", "service_pause", etc. This isn''t a major issue, since we haven''t released the code for that yet. Along those lines, however, I think we should change "worker" to "service_main". It''s a little more explicit and a little more in line with the name of the package (i.e. win32-service). I don''t normally like to switch something like this, but that''s one of the reasons I declared the Daemon code "Alpha" - in case I changed my mind ab...
2004 Feb 10
0
Daemon help
...s fine, but I can never start it successfully. What am I doing wrong? Dan # daemon.rb in ''C:\'' require "win32/service" include Win32 class Daemon def service_stop File.open("c:\\foo.log","a+"){ |f| f.puts "foo stopped" } end def service_main while state == RUNNING File.open("c:\\foo.log","a+"){ |f| f.puts "foo running" } sleep 5 end end end d = Daemon.new d.mainloop # END daemon.rb # daemonctrl.rb in ''C:\somedir'' require "win32/service" include Win32 SERVICE_NAME =...
2004 Feb 10
0
TCPServer failure within daemon
I wanted to see if I could setup a simple echo server to run as a service. So, using daemon_test.rb, I modified the Daemon class to something like this: require "socket" class Daemon def initialize @server = TCPServer.new("localhost",8888) end def service_main while state == RUNNING while session = @server.accept str = session.gets.chomp File.open("c:\\foo.log","a+"){ |f| f.puts "Got #{str}" } end end end end It starts up ok, but if I try to connect with a client on t...