Hi The service in this case is ypbind but it could apply to other services. The problem is that `service ypbind status'' returns 0 if the service is running even if it''s not bound to the domain. Replacing hasstatus with `status => "/usr/bin/ypwhich"'' doesn''t fix it either because puppet will then try to start the service (instead of restarting it) which fails because it''s already running. To cover both cases (not running or running but not bound), I configured it like this: service { "ypbind": ensure => running, enable => true, hasrestart => true, hasstatus => true, require => Package["ypbind"], } exec { "/sbin/service ypbind restart": path => ["/usr/bin", "/sbin"], unless => "ypwhich" } That works but I was wondering if there''s a better way not using exec. Thanks -- Ian -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Fri, Mar 11, 2011 at 11:37:42AM +1000, Ian Mortimer wrote:> The service in this case is ypbind but it could apply to other > services. The problem is that `service ypbind status'' returns 0 > if the service is running even if it''s not bound to the domain.Is there no reason you can''t just make the init script output what you want, or will that break other things horribly? That seems more the right thing for it to be doing in the first place? Otherwise the exec{} seems the path of least resistance. -- Ben Hughes || http://www.puppetlabs.com/ -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Stefan Schulte
2011-Mar-11 09:44 UTC
Re: [Puppet Users] keeping a service running properly
On Fri, Mar 11, 2011 at 11:37:42AM +1000, Ian Mortimer wrote:> Hi > > The service in this case is ypbind but it could apply to other > services. The problem is that `service ypbind status'' returns 0 > if the service is running even if it''s not bound to the domain. >What are the reasons that your service is running but not the way you like? -Stefan
On Fri, 2011-03-11 at 15:50 +1000, Ben Hughes wrote:> Is there no reason you can''t just make the init script output what you > want,A yum update would undo any changes to the init script.> Otherwise the exec{} seems the path of least resistance.Seems like it. Thanks for the reply -- Ian -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Fri, 2011-03-11 at 19:44 +1000, Stefan Schulte wrote:> What are the reasons that your service is running but not the way you > like?Mostly it does but occasionally after a network or power outage terminals reboot before they can contact the server which leaves ypbind running but not bound to any domain. -- Ian -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Thu, Mar 10, 2011 at 5:37 PM, Ian Mortimer <I.Mortimer@uq.edu.au> wrote:> Hi > > The service in this case is ypbind but it could apply to other > services. The problem is that `service ypbind status'' returns 0 > if the service is running even if it''s not bound to the domain. > > Replacing hasstatus with `status => "/usr/bin/ypwhich"'' doesn''t > fix it either because puppet will then try to start the service > (instead of restarting it) which fails because it''s already running. > > To cover both cases (not running or running but not bound), I > configured it like this: > > service { "ypbind": > ensure => running, > enable => true, > hasrestart => true, > hasstatus => true, > require => Package["ypbind"], > } > exec { "/sbin/service ypbind restart": > path => ["/usr/bin", "/sbin"], > unless => "ypwhich" > } > > That works but I was wondering if there''s a better way not > using exec.You might even need to specify so much logic you may as well deliver this as a script, but if you don''t, I believe this should work. service { "ypbind": ... restart => "/usr/bin/ypbind && /usr/bin/ypwhich", ... } -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Sun, Mar 13, 2011 at 9:02 PM, Nigel Kersten <nigel@puppetlabs.com> wrote:> On Thu, Mar 10, 2011 at 5:37 PM, Ian Mortimer <I.Mortimer@uq.edu.au> wrote: >> Hi >> >> The service in this case is ypbind but it could apply to other >> services. The problem is that `service ypbind status'' returns 0 >> if the service is running even if it''s not bound to the domain. >> >> Replacing hasstatus with `status => "/usr/bin/ypwhich"'' doesn''t >> fix it either because puppet will then try to start the service >> (instead of restarting it) which fails because it''s already running. >> >> To cover both cases (not running or running but not bound), I >> configured it like this: >> >> service { "ypbind": >> ensure => running, >> enable => true, >> hasrestart => true, >> hasstatus => true, >> require => Package["ypbind"], >> } >> exec { "/sbin/service ypbind restart": >> path => ["/usr/bin", "/sbin"], >> unless => "ypwhich" >> } >> >> That works but I was wondering if there''s a better way not >> using exec. > > You might even need to specify so much logic you may as well deliver > this as a script, but if you don''t, I believe this should work. > > service { "ypbind": > ... > restart => "/usr/bin/ypbind && /usr/bin/ypwhich", > ... > } >doh. ypbind still doesn''t have an exit code... Can you parse the output in a script to tell? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On 03/14/2011 04:55 AM, Ian Mortimer wrote:> On Fri, 2011-03-11 at 15:50 +1000, Ben Hughes wrote: > >> Is there no reason you can''t just make the init script output what you >> want, > > A yum update would undo any changes to the init script.Well you *would* roll your changed init script using puppet, so that''s not a problem. I do that, but it sometimes worries me that possible desirable changes from those yum updates can easily get lost, but I''m usually taking that chance. I don''t expect stable distributions to upload major fixes for their init scripts. So yes, I''d probably go with a fixed init script after all. Cheers, Felix -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Wed, 2011-03-16 at 18:15 +1000, Felix Frank wrote:> Well you *would* roll your changed init script using puppet, so that''s > not a problem.Except it would be an old init script, not necessarily compatible with the updated package.> I do that, but it sometimes worries me that possible desirable changes > from those yum updates can easily get lost, but I''m usually taking that > chance. I don''t expect stable distributions to upload major fixes for > their init scripts.This is on Fedora so not particularly stable. Although it''s not very likely the init script for ypbind would change, I prefer to avoid modifying init scripts if possible.> So yes, I''d probably go with a fixed init script after all.The exec{} seems like the lesser of two evils. -- Ian -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.