If you want to start jboss as normal user and not as root you can run <JBOSS_HOME>/bin/run.sh -c <config> -b <bind address>.
If this is too much or you might ensure that the jboss is started with exact the parameter you want feel free to write a script that use run.sh to start.
The script might located in /usr/local/bin (or other global path).
Also you might set the system bit to start as root or a special user, but you should check that you open no security leak.
We start JBoss in background and store the PID to ensure that we stop exact this instance, this can be done with kill <JVM PID> from the script.
Since you have myJBoss.sh (actually, it should just be named /etc/init.d/myJBoss, and I will assume this name in the rest of my post), why not set it up to autostart on boot?
Also, which distro of Linux? On Ubuntu you can do this:
sudo service myJBoss start
Though I guess that is still a lot of typing. But a script named 'jboss' that contains this should work:
sudo service myJBoss $*
We have sure set it up to autostart on boot by adding this to chkconfig list and turn it on. But very often we have to stop, start the Jboss by testing or sonmething else.
In the fact the file name is myJboss, not myJboss.sh. I added ".sh" to let one know this is a script. :-)
We use the LINUX LHEL 5. What should I do?
My last post is written in German, could you understand it?
1. OK, I understand.
2. Accuracy is important! Especially if you do not want useless advice.
3. I don't have a RHEL system available. And my Fedora system is at work (I'm at home). But googling shows that the "service" command is available on Fedora and has thge same syntax - the only thing you need to do is not use sudo. This should work:
service myJBoss $*
I recall enough of my high school and college German to read and understand your post, but not enough to reply in like manner!
sudo service myJBoss $*
Thanks for your answer. But maybe it's not what I want. :-/
What I want is: I don't want to type "/ect/ini.d/myJboss start" and enter the password to start the Jboss from my home. I want simply type "jboss start".
pipe in the root password into sudo. Needless to say, having your root password lying around in batch files is not a good idea. I said it anyway.
I agree with Nicklas - putting your password into a script file is a very bad idea. The most you can do is a simple script that runs "/etc/init.d/Jboss $*", but you will still have to enter the password manually.
And by the way, which password? Both Nicklas and I made some assumptions here, and they could be wrong. Is it the /etc/init.d/Jboss script that is asking for the password? Or are you first doing su and you need to enter the root password? Or are you running sudo ("sudo /etc/init.d/Jboss start") and sudo is prompting for your password? (Reread my prior post for asnwer #2!)