Hi Jochen,

When amavis is in the broken state, does `service amavis start` fix it or
is it just `service amavis restart` that fixes it? If 'restart' works, but
'start' doesn't, I wonder if Puppet is running the start command instead of
restart. Running the puppet agent in debug mode should show you the actual
command being run. If you see `systemctl start amavis` is being run, you
might try setting the `start` parameter to what you have `restart` set to:

service { 'amavis':
...
        start => '/usr/sbin/service amavis restart',
...
}

Thanks,

Nick

On Fri, Dec 1, 2023 at 11:39 AM Jochen Haeberle <[email protected]>
wrote:

> now I have a declaration that kicks in when the problem occurs:
>
> service { 'amavis':
>         hasrestart => true,
>         provider => 'systemd',
>         restart => '/usr/sbin/service amavis restart',
>         status => '/usr/bin/systemctl is-active --quiet amavis && [
> "$(/usr/bin/systemctl show -p SubState --value amavis)" = "running" ] &&
> exit 0 || exit 1',
>         ensure => running
> }
>
>
> the status-line detects the problem fine and when I run this, puppet says
> it’s chaning the service status:
>
> Notice: /Stage[main]/Main/Service[amavis]/ensure: ensure changed 'stopped'
> to 'running'
>
> But it is not running after that. Manually running
>
> /usr/sbin/service amavis restart
>
> brings up the service fine.
>
> Anyone has a tipp what I am doing wrong?
>
> thx
>
> Am 28.11.2023 um 12:45 schrieb Jochen Haeberle <[email protected]
> >:
>
>
>
> Am 27.11.2023 um 17:54 schrieb 'Kenyon Ralph' via Puppet Users <
> [email protected]>:
>
>
> The service restarts manually fine with service amavis restart
>
> The question is not why it died but how to get it running again using
> Puppet.
>
>
>  Puppet simply runs systemctl start amavis if you have ensure => running.
> If it is dying, it most likely has nothing to do with Puppet.
>
>
> sure, Puppet is not involved in the dying. But my problem is, why it is
> not restarting the service. When I had the problem,
>
> service amavis start did not work, but service amavis restart did. So I
> changed my declaration to
>
> service { 'amavis':
>         hasrestart => true,
>         ensure => running
> }
>
> Perhaps this will work better.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/BD107A9D-ED3E-46F9-9A29-CF9D62FB4D94%40gmail.com
> <https://groups.google.com/d/msgid/puppet-users/BD107A9D-ED3E-46F9-9A29-CF9D62FB4D94%40gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAP15v%2B-MB6rKu26AZWqJtq3Z9Dy1QkcGt8Z2Dy%3DkYG-Mf2A9Lw%40mail.gmail.com.

Reply via email to