In this case the screen session stays forever and you can connect to it later to see the output. That may or may not be useful to you of course
--- Steve Traylen From: Dayton Jones <[email protected]> Sent: 15 Dec 2015 1:02 pm To: Puppet Users Subject: Re: [Puppet Users] Logging output of a long running exec Does that show the output during the puppet run though? I "need" to have the output of the script show up, hence the "logoutput => true" directive which I don't see in your example. The script runs just fine, I just don't get any output/status from it when run via puppet. On Tuesday, December 15, 2015 at 3:56:14 AM UTC-6, Steve Traylen wrote: Example of long exec running backgrounded in a screen. exec { 'zrep_initial_sync': command => "screen -dmS zrep_initial_sync /usr/local/sbin/krb_me.sh /usr/local/sbin/zrep init ${src_vol} ${dst_host} ${dst_vol}", onlyif => "zfs get -H zrep:src-fs -o value ${src_vol} | grep -qv ${src_vol}", path => ['/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/', '/usr/local/bin', '/usr/local/sbin'], } Sent from Nine<http://www.9folders.com/> From: Dayton Jones <[email protected]> Sent: 11 Dec 2015 9:45 pm To: Puppet Users Subject: [Puppet Users] Logging output of a long running exec I have a legacy "provisioning" script that I'm calling with puppet on brand new machines (I'm slowly taking the functionality out of the script and into puppet, but for reasons I can't do a full replacement yet) I'd like to log the output of the provisioning and have included "logoutput" to the exec in the class (see below) but when I run puppet all I get for the module/class is: Warning: Waiting for output; will sleep 0.0 seconds Warning: Waiting for output; will sleep 0.5 seconds Warning: Could not get output Notice: /Stage[post]/provision/Exec[provision.sh]/returns: executed successfully Notice: Finished catalog run in 107.80 seconds Here is the class and exec... I'm setting a timeout of 1800 and if the catalog run finishes in 107 seconds, I'm unclear on how it's timing out. Any suggestions? class provision { notify {'Running provision.sh can take a while - be patient':} file { '/root/provision.sh' : ensure => file, owner => 'root', group => 'root', mode => '0755', source => 'puppet:///modules/provision/provision.sh', notify => Exec['provision.sh'], } exec { 'provision.sh' : command => '/root/provision.sh', logoutput => true, timeout => 1800, cwd => '/root'; } } -- 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/1a15177f-e0f1-4d1b-8c87-5f7b47d7dede%40googlegroups.com<https://groups.google.com/d/msgid/puppet-users/1a15177f-e0f1-4d1b-8c87-5f7b47d7dede%40googlegroups.com?utm_medium=email&utm_source=footer>. For more options, visit https://groups.google.com/d/optout. -- 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]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/8dc78f95-4c00-4693-b659-9cdad3dc9ade%40googlegroups.com<https://groups.google.com/d/msgid/puppet-users/8dc78f95-4c00-4693-b659-9cdad3dc9ade%40googlegroups.com?utm_medium=email&utm_source=footer>. For more options, visit https://groups.google.com/d/optout. -- 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/3b2119b0-8647-4b84-b35d-cd4ade8d47b6%40cern.ch. For more options, visit https://groups.google.com/d/optout.
