I’ve used the win32 service rubygem like so: gem install win32-service --no-rdoc --no-ri --verbose --platform x86-mswin32 powershell "Install Service: MyService" do code <<-EOH c: cd /WindowsServices/MyService / ./Install.bat sc.exe failure MyService reset= 0 actions= restart/60 EOH not_if {Win32::Service.exists?("MyService")} end Which runs the powershell given if the service doesn’t exist. Cheers, Dave. From: Sascha Bates [mailto:
Thanks, this helps. On Tue, Feb 21, 2012 at 9:58 PM, Madhurranjan Mohaan <
" target="_blank">
> wrote: Some samples with the "windows_batch" resources: On Wed, Feb 22, 2012 at 7:20 AM, Sascha Bates <
" target="_blank">
> wrote: Can anyone point me to some example chef code using not_if/only_if on windows/powershell blocks? I have some ideas but I'm not sure they're very good. I need to set up a service and make sure I don't kick off a reboot or anything crazy
every time chef runs. Learning powershell syntax at the same time I'm wrangling chef for windows is not advised, but really, who am I kidding? When would I have bothered otherwise?
Sascha |
Archive powered by MHonArc 2.6.16.