I have recently set up Xvfb on Centos 7 machine.
It is working absolutely fine.
Only problem is that if I quit putty session (remote access) it would keep running Xvfb in background but display will be gone.
So next time when I take remote access via putty first I have to type export DISPLAY=:99 again, then I start my tests.
How can I make it permanent? I don't see solution to my problem in this thread How to make exported shell variables permanent?
Update: .profile contents:
export M3_HOME=/home/aditi.a/apache-maven-3.5.4/bin
export PATH=$PATH:$M3_HOME
export JMETER_HOME=/home/aditi.a/apache-jmeter-5.0/bin
export PATH=$PATH:$JMETER_HOME
export JAVA_HOME=/usr/java/jdk1.8.0_192-amd64
export PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export DISPLAY=:99
echo variables output:
$ echo $JAVA_HOME
/usr/java/jdk1.8.0_192-amd64
$ echo $M3_HOME
/home/adit.a/apache-maven-3.5.4/bin
$ echo $DISPLAY
$
which shell I am running
$ ps -p $$
PID TTY TIME CMD
30678 pts/14 00:00:00 sh
export DISPLAY=:99in.profilefile where JAVA, MAVEN environment variables are saved. Quit putty session and ran the tests, tests failed because display wasnt there, exported the display again and test run fine this time – Aditi Apte Oct 30 '18 at 10:47~/.profileas a fallback, if some other startup file isn't present. – JigglyNaga Oct 30 '18 at 10:57.profile, and confirm that the other variables set there do take effect (when you connect through putty/ssh)? – JigglyNaga Oct 30 '18 at 17:58echo $JAVA_HOME, orecho $M3_HOME, orecho $DISPLAY, what is the result? – JigglyNaga Oct 31 '18 at 07:41bash, do either.bash_profileor.bash_loginexist? – JigglyNaga Oct 31 '18 at 12:29ps -p $$– Aditi Apte Oct 31 '18 at 14:24.profile, it will setDISPLAYalong with the other variables. When I recreate the exact steps you've described (Centos 7, shell=/usr/bin/sh, setDISPLAYin~/.profile, connect via Putty),DISPLAYis set. So there must be something else non-standard about your setup, or a missing step you've not mentioned. If your problem can't be reproduced by anyone else, there's no way to investigate, and a "fix" won't be useful to anyone else. – JigglyNaga Oct 31 '18 at 15:31echo display=$DISPLAYlines at the start and end of.profileto see whether.profileisn't being (fully) used, or something else is unsetting the variable afterwards. – JigglyNaga Oct 31 '18 at 15:32