Windows service

So I see the Service resource has support for windows service. My question is, does it handle creating the service if it doesn’t exist? I have a dll I want to install as a service and then make sure it’s started. Do I need to create a custom SC command line to install the service?

From what I’ve seen you need to do the install job manually. There may be a better way to do this now, but this is how our stuff does it.

We install the win32-service ruby package and use it for “service is installed” detection.
(gem install win32-service --no-rdoc --no-ri --verbose --platform x86-mswin32)

Then we use this amazing snippet to install a service:

powershell “Install Service: SomethingGood” do
code <<-EOH
c:
cd /WindowsServices/SomethingGood/
./Install.bat
sc.exe failure SomethingGood reset= 0 actions= restart/60
EOH
not_if {Win32::Service.exists?(“SomethingGood”)}
end

Our Install.bat installs the service, contents depend on the application.

Cheers,
Dave.

From: Kendrick Martin [mailto:Kendrick.Martin@Webtrends.com]
Sent: Thursday, 1 December 2011 8:00 a.m.
To: chef@lists.opscode.com
Subject: [chef] Windows service

So I see the Service resource has support for windows service. My question is, does it handle creating the service if it doesn’t exist? I have a dll I want to install as a service and then make sure it’s started. Do I need to create a custom SC command line to install the service?