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]<mailto:[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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/4391113f-1763-47ad-a4ca-f0e54c3b2b6f%40cern.ch.
For more options, visit https://groups.google.com/d/optout.

Reply via email to