How to define Environmental Variables in Suse
Hello,
I am new to Linux. I have downloaded the binaries for Apache 2 and Tomcat 5 and want them to start automatically when the computer starts. When I start these processes, I do not see an entry in the Services so I cannot configure them using Yast2 in 'System Services'. I read some where that I can do by defining the entries in /etc/skel/.profile or /etc/skel/.bashrc. I did make the enteries in both of them but it still doesnt work. In addition to this I also tried to configure the JAVA_HOME and JRE_HOME environmental variables in .bashrc and .profile file but that also didnt work :confused: . Here are the entried that I made export JAVA_HOME=/home/ahayat/jdk1.5.0_06/ export JRE_HOME=/home/ahayat/jdk1.5.0_06/jre /usr/sbin/rcapache2 startssl /etc/apache-tomcat-5.5.17/bin/startup.sh Am I making a mistake here? Regards. |
you need to set those variables in etc/profile .... and maybe do a restart of the computer or sometimes just loggin out and logging back in will work ..
Sharp |
After adding to your .bashrc, did you remember to run "source .bashrc"?
|
Quote:
But, for the apache scripts to run automatically at start up, you must add them to your boot.local file. |
Quote:
Regards. |
Quote:
[ # PLEASE DO NOT CHANGE /etc/profile. There are chances that your changes # will be lost during system upgrades. Instead use /etc/profile.local for # your local settings, favourite global aliases, VISUAL and EDITOR # variables, etc ... And I could not find a profile.local file. Do I need to create one? Also the file /etc/profile looks complex, if at all I have to make the entries into it then how do I do it? Regards. |
The .bashrc file will be sourced every time you start your machine, you just need to resource it when you make changes.
You probably should put the lines for your services in your /etc/rc.d/rc.local (or equivalent, I'm not sure if this is standard to all distros) instead of .bashrc. |
Well, u have to add those two export statements at the end of the /etc/profile file. You don't have to change anything else. I have used Tomcat with the same method. It worked fine.
Quote:
|
Quote:
There is no rc.local file but I looked at the rc file but couldnt figure out how to add new lines. Do I add them like this test -s /usr/sbin/rcapache2 startssl || RUN_PARALLEL="no" or do I have to enclose it between if and fi? Regards. |
My appologies. you can add these commands to
Code:
/etc/init.d/boot.local |
Quote:
Quote:
|
Finally it worked.
On the first computer I was trying every thing so I made the changes in .bashrc, boot.local, /etc/profile :). When I rebotted the computer, both Apache and Tomcat were running but I can't really say which change actually did make them work. So then I went on another computer running Suse 10 and made the changes only in the boot.local file and could see that both Apache and Tomcat are running fine. So what I have learnt is that there are several ways of doing it. I can either do it through boot.local file, or make the changes in .baschrc file and then resource it. Regarding etc/profile, is this file used only to define environmental variables like JAVA_HOME etc. or can it also be used to start services like Apache etc.? Thanks for the help. Regards. |
Quote:
|
I have one other question. How can I define environmental variable so that I do not have to type path along with executable files. For instance to start Tomcat I type this /etc/apache-tomcat/bin/startup.sh whereas I would like to just type startup.sh and it should start the Tomcat server.
Thanks for the help. |
Quote:
Code:
export PATH=$PATH:/etc/apache-tomcat/bin |
All times are GMT -5. The time now is 02:11 AM. |