service - explicit stats command

7 views
Skip to first unread message

russell.fulton

unread,
Dec 7, 2010, 5:03:58 PM12/7/10
to Puppet Users
what should the service{...: ....., status=> <command>, ...... }
return ?

0 => not running ??

be a good idea to add this to http://docs.puppetlabs.com/guides/types/service.html

Russell

Daniel Pittman

unread,
Dec 7, 2010, 8:57:02 PM12/7/10
to puppet...@googlegroups.com
On Wed, Dec 8, 2010 at 09:03, russell.fulton <russell...@gmail.com> wrote:
> what should the service{...: ....., status=> <command>, ...... }
> return ?
> 0 => not running ??

The LSB result codes, ideally:
http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
(but 0 => running, !0 => not running should be fine.)

That would probably be a good idea, indeed. A ticket is the most
reliable way to record that, if you don't mind. :)

Regards,
Daniel
--
✣ Daniel Pittman            ✉ dan...@rimspace.net            ☎ +61 401 155 707
              ♽ made with 100 percent post-consumer electrons

russell.fulton

unread,
Dec 13, 2010, 10:15:02 PM12/13/10
to Puppet Users
I now have my service status command that does a kill -0 on all the
pid and return 1 if all the processes are running. I have this class/
service definition:

class snort($master) {
service{
"snort.$master":
start => "sudo -u snort /home/snort/bin/restart-snort
$master" ,
restart => "sudo -u snort /home/snort/bin/restart-snort
$master" ,
stop => "sudo -u snort /home/snort/bin/restart-snort -stop
$master",
status => "sudo -u snort /home/snort/bin/restart-snort -
status $master",
ensure => running,
subscribe => [ File[ "/home/snort/conf/$master/snort.conf", "/
home/snort/conf/$master/barnyard.conf"]],
}
}

but puppet always decides that the process is not running and tries to
start it.

notice: /Stage[post]/Monitor::Snort/Service[snort.dmzi]/ensure: ensure
changed 'stopped' to 'running'


Is there any way I can get more diagnostics than that returned by --
test?

luke.bigum

unread,
Dec 14, 2010, 5:05:23 AM12/14/10
to Puppet Users

On Dec 14, 3:15 am, "russell.fulton" <russell.ful...@gmail.com> wrote:
> I now  have my service status command that does a kill -0 on all the
> pid and return 1 if all the processes are running.  I have this class/
> service definition:

Russell,

That might be a typo in what you've written above but your script
should be returning zero if everything is all right, not 1. 1 would
indicate a problem and thus Puppet is trying to restart your service.

russell.fulton

unread,
Dec 14, 2010, 6:03:04 PM12/14/10
to Puppet Users
>
> That might be a typo in what you've written above but your script
> should be returning zero if everything is all right, not 1. 1 would
> indicate a problem and thus Puppet is trying to restart yourservice.
>

Doh! -- no typo - that's the problem. I even have the docs that say
it should be zero.

Thanks Luke.!
Reply all
Reply to author
Forward
0 new messages