[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] win32-service 0.1.0

Daniel Berger

10/11/2003 12:09:00 AM

Hi all,

I am very pleased to announce the first release of
win32-service. This is an interface for reporting,
and creating, Win32 services on Windows NT, 2000 and
XP Pro.

Synopsis
========
require "win32/service"
include Win32

s = Service.new(
:service_name => "foo",
:exe_name => "C:\\some_dir\\foo.exe",
:display_name => "My Foo Service"
)

s.create_service

Service.start("foo")
Service.pause("foo")
Service.resume("foo")
Service.stop("foo")

Service.delete("foo")

Service.getdisplayname("Schedule") # "Task Scheduler"
Service.getservicename("ClipBook") # "ClipSrv"

# Enumerate over all services, inspecting each struct

Service.services{ |s|
p s
puts
}

This is the first package I've released as part of the
win32utils project, located on RubyForge at
http://rubyforge.org/projects/w....

Feedback welcome. Enjoy!

Regards,

Dan

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping...

2 Answers

Park Heesob

10/11/2003 1:57:00 AM

0

Hi,
----- Original Message -----
From: "Daniel Berger" <djberg96@yahoo.com>
To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
Sent: Saturday, October 11, 2003 9:09 AM
Subject: [ANN] win32-service 0.1.0


> Hi all,
>
> I am very pleased to announce the first release of
> win32-service. This is an interface for reporting,
> and creating, Win32 services on Windows NT, 2000 and
> XP Pro.
>
...
>
> This is the first package I've released as part of the
> win32utils project, located on RubyForge at
> http://rubyforge.org/projects/w....
>
> Feedback welcome. Enjoy!
>

It is a useful package!

I think it is more useful if it is able to set or update start type of a
service.
And the exception handling like already started or aleady stopped is
required.

Thank you for your effort.

Regards,

Park Heesob



djberg96

10/11/2003 5:04:00 PM

0

"Park Heesob" <phasis@bcline.com> wrote in message news:<007301c38f9a$dc5c2df0$661b31d3@AA>...
> Hi,
> ----- Original Message -----
> From: "Daniel Berger" <djberg96@yahoo.com>
> To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
> Sent: Saturday, October 11, 2003 9:09 AM
> Subject: [ANN] win32-service 0.1.0
>
>
> > Hi all,
> >
> > I am very pleased to announce the first release of
> > win32-service. This is an interface for reporting,
> > and creating, Win32 services on Windows NT, 2000 and
> > XP Pro.
> >
> ..
> >
> > This is the first package I've released as part of the
> > win32utils project, located on RubyForge at
> > http://rubyforge.org/projects/w....
> >
> > Feedback welcome. Enjoy!
> >
>
> It is a useful package!
>
> I think it is more useful if it is able to set or update start type of a
> service.
> And the exception handling like already started or aleady stopped is
> required.
>
> Thank you for your effort.
>
> Regards,
>
> Park Heesob

Thanks for the feedback Park. I plan on adding start type, error
control, etc, options in the next release, so you'll get that.

As to the exception handling, I wondered about that. For example,
stopping an already stopped service apparently isn't an error in the
Win32 API. I thought that was peculiar, but I figured that if it
wasn't an error for Win32 it might be confusing if I forced an
Exception.

That's part of the reason I was going to add a "status()" class
method. Not only would folks be able to do a simple status check, I
would be able to use the method internally to possibly raise an
exception.

I guess it boils down to whether folks prefer to code something like
this:

if Service.status("ClipSrv") != "Stopped"
Service.stop("ClipSrv")
end

or this:

begin
Service.stop("ClipSrv")
rescue Win32ServiceException
puts "Service already stopped - ignoring stop request"
end

As things stand now, you can just do...

Service.stop("ClipSrv")

....and not worry about it.

I'll have to think about it between now and the next release.

Oh, and if you're interested in becoming a developer on the Win32Utils
project Park, I'd be happy to add you. :)

Regards,

Dan