[chef] managing windows services via chef


Chronological Thread 
  • From: Maven User < >
  • To: chef < >
  • Subject: [chef] managing windows services via chef
  • Date: Thu, 20 Oct 2011 14:48:06 -0400

Hello again all -

First - thanks all for all the really helpful replies to any/all earlier posts. I've been able to move pretty quickly because of the help.

Now I have a tougher question.

I'm trying to work with a windows service for an item that we build and install. 

This means stopping it if it exists, installing it if it doesn't and then starting it if it isn't already running.

I've tried to make the only_if/not_if be a "sc query <servicename>", but I'm seeing mixed results in different windows servers.

On Windows 7, if the service doesn't exist, I get a non-zero (1060) return value, on Windows server 2003 (R2), I get 0 regardless if the service exists or doesn't exist.

I've been thinking about just parsing the output of the "sc query" command versus just relying on the return value, but this is starting to feel kludgy.

Any suggestions?



Archive powered by MHonArc 2.6.16.

§