Re: [Puppet Users] can't get custom restart to work on a windows service

269 views
Skip to first unread message

Josh Cooper

unread,
Jul 25, 2012, 1:24:09 PM7/25/12
to puppet...@googlegroups.com
Hi Dan,

On Tue, Jul 24, 2012 at 4:00 PM, Dan McManus <mothb...@gmail.com> wrote:
>
> Basically, what I want to do is manage nsclient++ on windows. I am able to manage the files just fine, but restarting doesn't work because of bug 13489.

I'd recommend trying out the latest version of puppet 2.7.x, directly
from github. You should just need to patch
`lib/puppet/provider/service/windows.rb`. Normally, I'd point you to
our nightly builds, but the windows jobs haven't been running lately
due to some infrastructure reorganization. I'll sort that out next
week.

> So I thought I might circumvent it thusly:
>
>
> service { "NSClientpp":
> ensure => running,
> restart => 'c:/program files/nsclient++/scripts/restart.bat',
> subscribe => File["c:/program files/nsclient++/nsc.ini"],
> }
>
> and restart.bat is very simple:
>
> sc stop nsclientpp
> perl -e "sleep 10"
> sc start nsclientpp
> echo ran >> c:\restart.txt
>
> it has world read and execute permissions, so it should run, but restart.txt doesn't get created and the service still won't start on its own.
>
> My question is whether I am doing something wrong or is this is a bug?

The windows service provider doesn't currently support overriding the
`restart` method. We should either call that out in the provider
documentation or add the ability to override it. I've filed this as
https://projects.puppetlabs.com/issues/15693

Josh
--
Josh Cooper
Developer, Puppet Labs

Dan McManus

unread,
Jul 26, 2012, 1:52:07 PM7/26/12
to puppet...@googlegroups.com
I modified the windows.rb and it seems to work well now. Many thanks!

Dan

On Tuesday, July 24, 2012 5:00:09 PM UTC-6, Dan McManus wrote:
Hi!

I am encountering something that I am not sure is a bug or not, so I thought I'd post a question.

Running Puppet 2.7.18 on Windows 2003.

Basically, what I want to do is manage nsclient++ on windows. I am able to manage the files just fine, but restarting doesn't work because of bug 13489. So I thought I might circumvent it thusly:


    service { "NSClientpp":
        ensure => running,
restart => 'c:/program files/nsclient++/scripts/restart.bat',
subscribe => File["c:/program files/nsclient++/nsc.ini"],
    }

and restart.bat is very simple:

sc stop nsclientpp
perl -e "sleep 10"
sc start nsclientpp
echo ran >> c:\restart.txt

it has world read and execute permissions, so it should run, but restart.txt doesn't get created and the service still won't start on its own.

My question is whether I am doing something wrong or is this is a bug?

Thanks

Dan

Josh Cooper

unread,
Jul 27, 2012, 1:13:26 PM7/27/12
to puppet...@googlegroups.com
Hi Dan,

Great to hear. This issue will be fixed in puppet 2.7.19, which should
enter rc next week.

Josh
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/puppet-users/-/FkklIRSsF64J.
>
> To post to this group, send email to puppet...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
Reply all
Reply to author
Forward
0 new messages