[Win32utils-devel] Problem with starting service with win32-service

Daniel Berger djberg96 at gmail.com
Mon Aug 5 19:20:25 UTC 2013


Glad you got it working!

As of 0.8.1 you shouldn't need to do anything special. If you want to do
any custom cleanup, just define a service_stop method in your Daemon
subclass, and that will get run first, before it finally stops.

Cheers,

Dan

On Mon, Aug 5, 2013 at 12:53 PM, Sean Karlage <sean.karlage at uky.edu> wrote:

> I've gotten my service to start successfully. Thank you all for your help.
>
> As a followup question, what is the recommended way to gracefully exit
> from within the service?
>
>
> On Mon, Aug 5, 2013 at 10:02 AM, Sean Karlage <sean.karlage at uky.edu>wrote:
>
>> Do I need to require win32/daemon in the controller as well?
>>
>>
>> On Sat, Aug 3, 2013 at 1:32 AM, Heesob Park <phasis at gmail.com> wrote:
>>
>>> Hi,
>>>
>>> 2013/7/25 Sean Karlage <sean.karlage at uky.edu>:
>>> > Hi all,
>>> >
>>> > At Daniel's request, I'm posting my problem to this mailing list in
>>> the hope
>>> > that it can be resolved.
>>> >
>>> > I'm using Windows 7 x64 in a virtual machine with an OS X 10.8.4 host,
>>> and
>>> > I'm using win32-service 0.8.0 (obtained via a gem install). Ruby
>>> version is
>>> > ruby 2.0.0p195 [x64-mingw32].
>>> >
>>> > This service monitors a directory (and all files and subdirectories
>>> under
>>> > it) and notifies owners of those files at the emails in a file of
>>> > corresponding emails to usernames when they haven't been
>>> modified/touched in
>>> > some configurable amount of days. After some other (longer) number of
>>> days,
>>> > the files are purged.
>>> >
>>> > I can install my service just fine, and it is picked up when I do a
>>> > Service.status() on it. However, when I go to actually start the
>>> service I
>>> > immediately get 'The service did not respond to the start or control
>>> request
>>> > in a timely fashion.' I followed Daniel's suggestion on his github
>>> page and
>>> > wrapped my service in a begin/end block, and ensured that the command
>>> > executable was correct, but control doesn't even seem to be getting to
>>> my
>>> > service code at all - control does not even enter service_main at all
>>> as far
>>> > as I can tell.
>>> >
>>> > I've attached my code, as well as a sample configuration file. I'd
>>> > appreciate any help with this.
>>> >
>>> > All three files should be in the same directory when they are run. It
>>> can be
>>> > executed as follows:
>>> >
>>> > ruby sharecleaner_daemon_controller.rb [-config C:/path/to/config/file]
>>> > [-emails C:/path/to/emails/file] install|start|uninstall|pause|resume
>>> >
>>> You should use
>>>     require 'win32/daemon'
>>> instead of
>>>     require 'win32/service'
>>> in the file sharecleaner_daemon.rb line 5.
>>>
>>> Regards,
>>> Park Heesob
>>> _______________________________________________
>>> win32utils-devel mailing list
>>> win32utils-devel at rubyforge.org
>>> http://rubyforge.org/mailman/listinfo/win32utils-devel
>>>
>>
>>
>
> _______________________________________________
> win32utils-devel mailing list
> win32utils-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/win32utils-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/win32utils-devel/attachments/20130805/c68726a9/attachment.html>


More information about the win32utils-devel mailing list