Here is what I am trying to do:
service{ foo:
...
restart => "/path/to/script/to/run 2>&1 | tee
/path/to/where-I-want-logfile-`date +%Y%m%d-%H%M%S`.log",
...
}
What I get is a log file named "/path/to/where-I-want-logfile-`date"
I have unsuccessfully tried escaping the command quotes with a back-slash.
Other than wrapping the while thing in another script, is there any way to fix
this ?
“Sometimes I think the surest sign that intelligent life exists elsewhere in the
universe is that none of it has tried to contact us.”
Bill Waterson (Calvin & Hobbes)
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Dan Rao
2011-Dec-15 20:33 UTC
Re: [Puppet Users] Commands within commands within a manifest
You could try: tee /path/to/where-I-want-logfile-$(date +%Y%m%d-%H%M%S).log Alternatively, since it doesn''t look like you''re using any puppet variables in the command string, you could try using single quotes (i.e. restart => ''/path/ ...'') so puppet won''t try to interpret anything it sees in there. Best, Dan On 12/15/2011 12:48 PM, Dan White wrote:> Here is what I am trying to do: > > service{ foo: > ... > restart => "/path/to/script/to/run 2>&1 | tee /path/to/where-I-want-logfile-`date +%Y%m%d-%H%M%S`.log", > ... > } > > What I get is a log file named "/path/to/where-I-want-logfile-`date" > > I have unsuccessfully tried escaping the command quotes with a back-slash. > Other than wrapping the while thing in another script, is there any way to fix this ? > > “Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” > Bill Waterson (Calvin & Hobbes) >-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Dan White
2011-Dec-15 21:39 UTC
Re: [Puppet Users] Commands within commands within a manifest
Thanks for the suggestions.
tee /path/to/where-I-want-logfile-$(date +%Y%m%d-%H%M%S).log did not work.
bash: syntax error near unexpected token `(''
I will let you know if the single quote option works.
“Sometimes I think the surest sign that intelligent life exists elsewhere in the
universe is that none of it has tried to contact us.”
Bill Waterson (Calvin & Hobbes)
----- Dan Rao <dhananja@cs.wisc.edu> wrote:> You could try:
>
> tee /path/to/where-I-want-logfile-$(date +%Y%m%d-%H%M%S).log
>
> Alternatively, since it doesn''t look like you''re using
any puppet
> variables in the command string, you could try using single quotes
> (i.e. restart => ''/path/ ...'') so puppet
won''t try to interpret anything
> it sees in there.
>
>
> Best,
> Dan
>
>
> On 12/15/2011 12:48 PM, Dan White wrote:
> > Here is what I am trying to do:
> >
> > service{ foo:
> > ...
> > restart => "/path/to/script/to/run 2>&1 | tee
/path/to/where-I-want-logfile-`date +%Y%m%d-%H%M%S`.log",
> > ...
> > }
> >
> > What I get is a log file named
"/path/to/where-I-want-logfile-`date"
> >
> > I have unsuccessfully tried escaping the command quotes with a
back-slash.
> > Other than wrapping the while thing in another script, is there any
way to fix this ?
> >
> > “Sometimes I think the surest sign that intelligent life exists
elsewhere in the universe is that none of it has tried to contact us.”
> > Bill Waterson (Calvin & Hobbes)
> >
>
> --
> 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+unsubscribe@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
>
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
Felix Frank
2011-Dec-16 14:37 UTC
Re: [Puppet Users] Commands within commands within a manifest
Well, On 12/15/2011 10:39 PM, Dan White wrote:> Thanks for the suggestions. > tee /path/to/where-I-want-logfile-$(date +%Y%m%d-%H%M%S).log did not work. > > bash: syntax error near unexpected token `(''if you''re not using single quotes, you shall have to escape the dollar sign so puppet doesn''t try to expand a variable. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.