Best way to start JBoss AS - jboss6.x

I like to ask what is best way to start jboss AS.
Because, whenever i close terminal or press ctrl+c then jboss, which is already started with run.sh script, start with shutdown. I have already tried executing export LAUNCH_JBOSS_IN_BACKGROUND=1 before starting jboss via script .run.sh but it has not helped me much.
Secondly, i like to know how can i validate that jboss is running except browsing localhost:8080 or localhost:8080/admin-console.
I am using both mac-osx/linux and Jboss-AS-6.0.0.Final.

nohup /usr/local/jboss/bin/run.sh -b 0.0.0.0 > /dev/null & should do starting jb as well running it in background.
You can check for jboss running using ps -ef | grep java

For the first part of the question, try running:
./run.sh &
This will send the process to the background. Just hit enter once JBoss has finished starting up.
If you need to bring the process back to the foreground, run fg. You can then hit CTRL-C if you want stop JBoss.
To validate that jboss is running, you can run something like this :
ps -ef | grep jboss
or
ps -ef | grep run.sh
This will show the process id for JBoss or the run.sh script.
I hope this helps.

Related

centos | perl processes are not shown

I have a centos server in which I have install perl package to run some perl scripts. today I run some perl scripts, and when I run ps -ef | grep perl it shows nothing although the scripts are working properly.
When I use pkill -f (name_of_script) the perl process stopped however they are not shown at all.
Note that yesterday I deleted a user ( X ) which was affected to folder /home/scripts. What do you think the problem is from?
The reason for not showing the process in ps -ef might be due to the process being run as a background process. In that case, the process won't be associated with the terminal where you started it from and thus won't be shown in the output of ps -ef. To see all processes running on the system, including background processes, you can use ps aux instead.

Send command to a nohup process?

I have a minecraft server that when I run it, takes the console and can receive commands/parameters.
I'm running it with nohup java -Xms.... -jar spigot.jar &. It will stay in the background with PID XXXX and port YYYY.
I want know if it is possible to send commands to it as /help.
Regards and thanks for the help.
Instead of running your server in the background with nohup java -Xms.... -jar spigot.jar & you could use a terminal multiplexer like screen.
See https://ss64.com/bash/screen.html
or https://www.gnu.org/software/screen/manual/screen.html
For interactive start, run screen first, then inside the screen session run java -Xms.... -jar spigot.jar (in the foreground, without nohup or &).
Then you can use screen's escape sequence CTRL+a d to detach from the session. Your server will continue to run.
If you later want to interact with the server, use screen -r. This will reattach your terminal to the session.
Type /help or whatever you need to do.
When you are done, detach from the session again.
You could also use screen -d -m java -Xms.... -jar spigot.jar to create a detached session with your command, e.g. in a startup script.
screen has a lot more capabilities. Read the documentation.
I can solved this by tripleee.
This works "nohup tail -f /usr/server/console.in | nohup java -Xms.... -jar spigot.jar >> /usr/server/console.out &"
Whit"echo command >> /usr/server/console.in"
Is as i run the command in the server.

BASH - how to make this always running from system boot and on crash restart?

I have this protocol port open to read remotely from Python, PHP applications but daily it crash and the port is unavailable as a result Python, PHP all client application fails
$ cat /var/tmp/server.sh
#!/bin/bash
while true; do tail -f /usr/local/freeswitch/log/freeswitch.log | nc -l -p 9999 -q 1 &
Q. Is there anyway to make this script always running like service this start or stop and if its crashed that somehow it automatically again get restarted ? Any advise or link to do such thing? i am using CentOS 6.x
Put your script in /etc/inittab as following
id:1:respawn:/var/tmp/server.sh
Refer to http://linux.about.com/od/commands/l/blcmdl5_inittab.htm for more information about the /etc/initab file.
After editing /etc/inittab restart your system.

How to know if the process is set NOHUP?

Using jobs I know the process is running.
bash-4.2$ jobs
[1]+ Running test.sh &
I wanted it to be set NOHUP so that it won't be killed when I exit. I used
disown
and
bash-4.2$ jobs
shows nothing. I'm not sure if the process is set NOHUP or not. I'm curious about this because after I read the manual it says
disown -h
should be used to set NOHUP.
Edit
I don't think the link Find the Process run by nohup command helps. The question is different than that one.
I'm gonna restate my problem. I run a program without nohup, and later I wanted it to be set NOHUP so that it won't be killed when I exit the system. So I used disown, but later I found the manual says I should have used disown -h to set NOHUP. I want to check if my process is set NOHUP or not successfully. If not, what can I do to set it to be NOHUP?
UPDATE
I know two ways my be helpful:
1) Whenever a process is running over nohup It writes output on ~/nohup.out . So you can check this file by running command find -cmin 2. It shows you if nohup.out is changing each 2 seconds or not.
If it is changing you would understand that sth is running by nohup command, after that you can check it with lsof and continue your checking...
2) If you logout from specific user andgo to tty then do ps aux | grep <user> or ps aux | grep ? then you can understand that is running with nohup command... because there is no pts then it shows you ? instead...
useful command:
ps aux | grep <program> | awk -F" " '{print $7}'
Hope to be helpful

JBoss Server Stopping

I'm having a problem with keeping a JBoss server running. Here's the command I'm using to start it:
sudo /JBOSS_HOME/bin/run.sh conf -b servername.domainname.tld
JBoss starts okay after about 4 minutes or so, and when I ps it, it shows up as a process. However, if I happen to log out of SSH and ps again, it's been stopped. Is there a way to start the server so it doesn't automatically stop when a user logs out of SSH?
I think the problem here is the standard output stream.
Redirect the output to a file and start the process in background like following.
sudo /JBOSS_HOME/bin/run.sh conf -b servername.domainname.tld > log_file &
This may help.

Resources