Re: Startup Scrpts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



paul lawrence wrote:
I am new to the world of linux, for my sins I have been entirely a Microsoft person; untill now, and I need some advice on how to do something. I have a server running Fedora Core 3, with Resin. I want to be able to create a startup script that will set some environment variables for Java, start up Resin and the call two custom scripts I have been given. I have been playing around with a file called resin-a.sh which a web site suggested creating to run the commands I want.
From a promt, if I type the following the variables are set OK, but if I include them in the resin-a.sh file and type sh resin-a.sh they are not set.
export set JAVA_HOME=/usr/java/j2sdk1.4.2_06
export set RESIN_HOME=/usr/local/resin
export set PATH=$PATH:/usr/java/j2sdk1.4.2_06/bin

Actually they are set but only within the environment of the script itself. Unix scripts, unlike Windows batch files, cannot change the environment of their parent process. Once the script terminates, so does the shell running it and you're back with the environment you started with. However, this should not be a problem in your application, since you'll be starting up resin within your script and it will inherit the right environment. If you want to convince yourself of this, put an "env" command at the end of your script to print out the environment.


I also want to somehow include in this script a startup command for httpd.sh to start the resin web server and also to call to other scripts.
Any help would be much appreciated, as I said I am completely new to this and its a little confusing.

Try: http://www.tldp.org/LDP/abs/html/ for a guide to bash scripting.

P.S. please post in plain text to this mailing list.

Paul.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux