On Tuesday, May 22, 2018 at 1:38:08 AM UTC-5, Thomas Müller wrote:
>
> Hi
>
> If I define:
>
> exec { '/bin/sleep 300 &':
>   timeout => 10,
> }
>
> and run it with puppet apply: it happily starts the sleep, backgrounds it 
> and finishes - leaving the sleep in the background alive.
>
> Is this behaviour as expected?
>


It's what *I* would have expected, at any rate.

 

> I personally expected that puppet would ensure all started processes are 
> killed if once the exec resource finishes.
>


I'm not sure why someone would expect that.  The documentation of the Exec 
resource type does not describe any such behavior, and it seems pretty 
arbitrary considering how generic Exec resources are.  Why shouldn't one be 
able to use an Exec to launch a background process?  Why should Puppet 
forcibly prevent such a background process from outliving the application 
of the Exec that starts it, or even the whole catalog run?  What if that 
was the whole point of the Exec in the first place?

Perhaps it's a matter of interpretation.  If the command of an Exec 
expresses starting a process in the background, then its job is 
successfully completed when the background job is started.  If you want an 
Exec to run a command to completion, then have it run that command in the 
foreground (the usual case).  Through no coincidence at all, this mirrors 
the behavior of background jobs launched by a non-interactive shell.


John

-- 
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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/6d80c125-e2b2-4b04-84a3-65f9f45ac524%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to