Ask Your Question
0

Exec takes too long to run script

asked 2015-01-25 05:50:30 -0500

umairch gravatar image

updated 2015-01-25 11:44:22 -0500

GregLarkin gravatar image

Below is the class for pushing content to agents and run the script

class push{
}
staging::deploy { 'Linux-hardening.zip':
  source => 'puppet:///modules/push/Linux-hardening.zip',
  target => '/root',
  notify =>  Exec['Changing permissions of hardening script']
}

exec{ "Changing permissions of hardening script":
        command => "chmod +x /root/Linux-hardening/Linux-hardening/hardening/hardeingscript.sh",
        path => "/bin",
        logoutput => true,
        notify => Exec['Run Script'],
}

exec{ "Run Script":
        command => "/root/Linux-hardening/Linux-hardening/hardening/hardeingscript.sh",
        logoutput => true,
}

Following is the output of puppet agent --test [After unzipping the tar file exec gets stuck at running "/root/script/Linux-hardening/Linux-hardening/hardening/hardeingscript.sh" command. I dont know why its taking too long to just run a simple command which will run the script.

[root@umairtest ~]# puppet agent --test
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for umairtest
Info: Applying configuration version '1422162159'
Notice: /Stage[main]/Staging/File[/root/script]/ensure: created
Notice: /Stage[main]/Main/Staging::File[Linux-hardening.zip]/File[/root/script//Linux-hardening.zip]/ensure: defined content as '{md5}050e1cd8f5096eb5a7415ce574bfbc66'
Notice: /Stage[main]/Main/Staging::Extract[Linux-hardening.zip]/Exec[extract Linux-hardening.zip]/returns: executed successfully
Info: Staging::Extract[Linux-hardening.zip]: Scheduling refresh of Exec[Changing permissions of hardening script]
Notice: /Stage[main]/Main/Exec[Changing permissions of hardening script]/returns: executed successfully
Info: /Stage[main]/Main/Exec[Changing permissions of hardening script]: Scheduling refresh of Exec[Run hardening script]
Notice: /Stage[main]/Main/Exec[Changing permissions of hardening script]: Triggered 'refresh' from 1 events
Info: /Stage[main]/Main/Exec[Changing permissions of hardening script]: Scheduling refresh of Exec[Run hardening script]
Error: Command exceeded timeout
Wrapped exception:
execution expired
Error: /Stage[main]/Main/Exec[Run hardening script]/returns: change from notrun to 0 failed: Command exceeded timeout
edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
3

answered 2015-01-25 17:21:53 -0500

Stefan gravatar image

updated 2016-02-03 01:36:06 -0500

How does the script behave, if you run it from the commandline? The exec resource will block until the command specified with the command parameter terminates which does not seem to happen in your case (or at least not before the 5 minute timeout).

One explanation could be that the script expects to get userinput and blocks at some point. But if the hardeingscript.sh script has to do complicated tasks, the long run time might be expected. In that case you can specify a timeout parameter for this specific exec resource (the default is 5 minutes).

edit flag offensive delete link more
1

answered 2016-02-03 01:38:32 -0500

updated 2016-02-03 01:39:01 -0500

A simple way to disable the timeout globally is to add to site.pp:

Exec {
  timeout => 0,
}

If you're behind a slow internet connection and have manifests that depend on downloading software via exec, exceeding this 5 minute timeout is a common problem.

edit flag offensive delete link more
0

answered 2015-01-29 06:35:09 -0500

umairch gravatar image

Yes i run the script manually and found that scripts execution time exceeds the exec default timeout value. Resolved the issue by setting appropriate timeout window. Thanks Stefan

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-01-25 05:50:30 -0500

Seen: 2,573 times

Last updated: Feb 03 '16