-
1. Re: How to set environment variable for run.sh process
wdfink Jul 17, 2015 2:05 PM (in response to sandeep.donthula)I don't understand what you are doing.
If you do
MYENV=xyz
you should able to use it in the script.
Could you elaborate on this?
-
2. Re: How to set environment variable for run.sh process
sandeep.donthula Jul 18, 2015 1:59 AM (in response to wdfink)Thanks for the reply. I am doing following in run.sh.
export MYENV=xyz
It's setting environment variable "MYENV" for the child Java processes.
I want to set for run.sh process itself. I hope You got my requirement.
-
3. Re: How to set environment variable for run.sh process
mayerw01 Jul 18, 2015 6:16 AM (in response to sandeep.donthula)If you set the environment variable (via export) before calling run.sh it should be used by run.sh.
-
4. Re: How to set environment variable for run.sh process
sandeep.donthula Jul 18, 2015 10:06 AM (in response to mayerw01)Yes. I tried that as well. "run.sh" is called form "jboss_init_redhat.sh"
I tried the same (export MYENV=xyz) in "jboss_init_redhat.sh" but that also didn't work. Any idea ?
-
5. Re: How to set environment variable for run.sh process
mayerw01 Jul 18, 2015 12:44 PM (in response to sandeep.donthula)This should work. What is your Linux/Unix version?
What exactly did you do? Could you post the extract of your script?
How did you realize that this is not working as expected?
-
6. Re: How to set environment variable for run.sh process
sandeep.donthula Jul 18, 2015 1:50 PM (in response to mayerw01)Linux version : Red Hat Enterprise Linux Server release 6.5 (Santiago)
jboss_init_redhat.sh and run.sh files shared here: https://drive.google.com/folderview?id=0B9aqoDIYpWvAfmp0ZWJ0S3dBem9kN2xTS05PSFZMLS1CRFBtcDA1cTJvNUJVcHBiVUNTVVk&usp=sharing
You can see export INFA_APPLICATION_SERVICE_TYPE="ReportingService" in scirpts
I am checking through following command : xargs --null --max-args=1 < /proc/1902/environ (Eg;1902 is pid of run.sh). The environement variable not getting listed. (Through a Java program also, we are not able to see this environement variable for run.sh process)
-
7. Re: How to set environment variable for run.sh process
mayerw01 Jul 19, 2015 6:09 AM (in response to sandeep.donthula)I cannot read the files you mentioned in your URL.
But when I execute a script containing only these 2 lines (open SuSE 13.2):
export INFA_APPLICATION_SERVICE_TYPE="ReportingService"
$JBOSS_HOME/bin/run.sh
and execute the following command afterwards:
xargs --null --max-args=1 < /proc/8985/environ | grep INFA
I get following feedback
INFA_APPLICATION_SERVICE_TYPE=ReportingService
Maybe I did not understand your issue correctly.
But you could also verify this by just adding: echo $INFA_APPLICATION_SERVICE_TYPE to run.sh
-
8. Re: How to set environment variable for run.sh process
sandeep.donthula Jul 20, 2015 2:54 AM (in response to mayerw01)Did You set export INFA_APPLICATION_SERVICE_TYPE="ReportingService" through jboss_init_redhat.sh/jboss_init_suset.sh ?
I tried echo as well. It's not printing anything.
The files are shared here: https://jumpshare.com/b/VxUkvNlNN4iaQT6M2OFT
-
9. Re: How to set environment variable for run.sh process
mayerw01 Jul 20, 2015 5:12 AM (in response to sandeep.donthula)I think the issue in your jboss_init_redhat.sh is that this script is redirecting the output to null by default.
If you export the JBOSS_CONSOLE to something else (eg to a file) before starting this script you should find this log entries there.
-
10. Re: How to set environment variable for run.sh process
sandeep.donthula Jul 20, 2015 6:43 AM (in response to mayerw01)Yes. Output is redirected to a log file.
I checked log file only. I updated the above url with one more file "console-redirect-log" . You can observe there "Service Type: "
-
11. Re: How to set environment variable for run.sh process
mayerw01 Jul 20, 2015 9:17 AM (in response to sandeep.donthula)I am not sure understanding you correctly.
Are you now seeing the environment variable in your logfile?
-
12. Re: How to set environment variable for run.sh process
sandeep.donthula Jul 20, 2015 10:44 AM (in response to mayerw01)Nope
-
13. Re: How to set environment variable for run.sh process
mayerw01 Jul 21, 2015 8:34 AM (in response to sandeep.donthula)There might be the case that the export built-in command does not work correctly.
So you may try
INFA_APPLICATION_SERVICE_TYPE=ReportingService; export INFA_APPLICATION_SERVICE_TYPE
-
14. Re: How to set environment variable for run.sh process
wdfink Jul 21, 2015 9:34 AM (in response to sandeep.donthula)What if you use a very simple script to check:
test1.sh
export MYENV1=Hello
MYENV2=Hello2
./test2.sh
test2.sh
echo "1=$MYENV1"
echo "2=$MYENV2"
In this case 2 should be empty