Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

can a backtick be used in a snippet?

can a backtick be used in a snippet?

New Contributor

I'd like to reference the hostname in an environment snippet. Is this possible? I tried:

 

FOO="... host=`hostname`"

 

However FOO results in the same string as above, without executing the hostname command

4 REPLIES 4
Highlighted

Re: can a backtick be used in a snippet?

New Contributor

Replying to my own post, it appears the contents of the snippet value for environment variables is enclosed in single quotes. That's why the backtick command execution is not happening. So the question is - is there anyway to have dynamic values in enironment settings? For example, reference another environment variable, or use ` or $(...)

Re: can a backtick be used in a snippet?

Super Guru

@blong,

 

The real issue here is that CM writes all the environment variables you specify (and others determined internally) to a supervisor.conf file for that process.  The supervisord process then starts the process using supervisor.conf variables.

This means that it is the supervisord that needs to know how to set environment variables dynamically and I don't think that is a feature supported in supervisord at this time.

 

Depending on what you are trying to accomplish, there may be other ways to do this without environment variables.

Re: can a backtick be used in a snippet?

New Contributor

Thanks for the response. I'm just trying to pass in a -D property to a HDFS process that includes the actual hostname of the server it's running on. Is there a way to make changes to HDFS startup scripts without breaking CM?

Re: can a backtick be used in a snippet?

Expert Contributor

There is no option to dynamically set options. Please explain what parameter you want to set explicitly to what value, and why this is needed.