Re: [Puppet Users] Re: How do I "cd" (change directory) with Puppet's exec?
On Fri, Jul 06, 2012 at 08:44:51AM -0700, jcbollinger wrote: > > > On Friday, July 6, 2012 2:10:13 AM UTC-5, Hendrik Jäger wrote: > > > > [...] let a shell > > execute your command [...] > > > > Which you can do fairly easily by adding "provider => 'sh'" to your Exec's > parameters. > > Or if you need a non-default shell or you just like doing things the hard > way, then you can use a variation on > > bash -c 'my command here' > > as your command. Instead of doing these kinds of work-arounds I'd just use the cwd parameter of the exec resource as described in the type reference [1] so e.g. exec { 'make_sendmail': command => '/usr/bin/make', cwd => '/etc/mail' } If you have GNU make you can also ask the make command itself to change the directory (-C dir, --directory=dir) [1] http://docs.puppetlabs.com/references/latest/type.html#exec -Stefan -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Re: How do I "cd" (change directory) with Puppet's exec?
On Friday, July 6, 2012 2:10:13 AM UTC-5, Hendrik Jäger wrote: > > [...] let a shell > execute your command [...] > Which you can do fairly easily by adding "provider => 'sh'" to your Exec's parameters. Or if you need a non-default shell or you just like doing things the hard way, then you can use a variation on bash -c 'my command here' as your command. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/bS6ih5Uij6sJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Re: [Puppet Users] Re: How do I "cd" (change directory) with Puppet's exec?
Hi, On Thu, 5 Jul 2012 22:33:00 -0700 (PDT) Benjamin Lei wrote: > Specifically, when I have "cd" in command => ".." it says it cannot > find the command "cd". Because it is a builtin command in the shell. Either let a shell execute your command or use the pwd (or cwd?) parameter. Best regards Hendrik Jäger signature.asc Description: PGP signature
[Puppet Users] Re: How do I "cd" (change directory) with Puppet's exec?
Specifically, when I have "cd" in command => ".." it says it cannot find the command "cd". On Thursday, July 5, 2012 10:31:38 PM UTC-7, Benjamin Lei wrote: > > I sort of "need" to do this to run a Makefile that uses local > directories... -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/bE3G2xpCy_gJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.