On 2010-12-21 09:14, Nick Moffitt wrote:

> Nigel Kersten:
>> Can you use the "basic" service provider with fully-specified
>> start/stop/restart commands to achieve what you need?
> 
> Are you suggesting that I override the start command to a noop, and make
> sure the restart command works in that scenario?  Thinking that over, it
> has potential.  I suppose it would refrain from starting a crashed
> service, but it would pass the test in type/provider.rb that's been
> causing me grief:

Some init scripts support a 'condrestart' action, that will only
restart the service if it is already running.  For example, on a
Fedora machine:

    # service sshd status
    openssh-daemon (pid  21829) is running...
    # service sshd condrestart
    Stopping sshd:                                             [  OK  ]
    Starting sshd:                                             [  OK  ]
    # service sshd status
    openssh-daemon (pid  21900) is running...
    # kill -9 21900
    # service sshd status
    openssh-daemon dead but pid file exists
    # service sshd condrestart
    # service sshd status
    openssh-daemon dead but pid file exists

You should be able to write something like this (using the sshd service
as an example):

    service {
        "sshd":
            enable => true,
            ensure => undef,
            hasstatus => true,
            restart => "/sbin/service sshd condrestart",
            subscribe => File["/etc/ssh/sshd_config"];
    }

I *think* this works the way you want.  You would have to make sure that
the init script has a condrestart action that works properly.  If not, you
would have to write your own command in the restart parameter that works
the way you want.


        /Bellman

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to