# Centos
su jboss -c '$JBOSS_HOME/bin/run.sh -b 0.0.0.0 > /dev/null 2> /dev/null &'
# Ubuntu
sudo -u jboss $JBOSS_HOME/bin/run.sh -b 0.0.0.0 > /dev/null 2> /dev/null &
Stopping jboss actually should be done by running this
# Centos
su jboss -c '$JBOSS_HOME/bin/shutdown.sh -S &'
# for ubuntu
sudo -u jboss '$JBOSS_HOME/bin/shutdown.sh -S &'
But in my system this will Exception in thread "main" java.lang.SecurityException: Failed to authenticate principal=null, securityDomain=jmx-console. This is happen because likely we have enabled the interceptor in jmx-invoker-service.xml file in deploy folder. Then for shuttingdown jboss we should provide some credential that we can see at login-config.xml file in the conf folder.
So the shutdown command should be like this
# Centos
su jboss -c '$JBOSS_HOME/bin/shutdown.sh -S -u admin -p admin &'
# for ubuntu
sudo -u jboss '$JBOSS_HOME/bin/shutdown.sh -S -u admin -p admin &'
Actually there still some exception when running this.
javax.management.InstanceNotFoundException: jboss.remoting:service=invoker,transport= bisocket,host=sudirman.nfsint.com,port=4457,JBM_clientMaxPoolSize=200,clientLeasePeriod=10000,clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper,dataType=jms,marshaller=org.jboss.jms.wireformat.JMSWireFormat,numberOfCallRetries=1,numberOfRetries=10,pingFrequency=214748364,pingWindowFactor=10,socket.check_connection=false,timeout=0,unmarshaller=org.jboss.jms.wireformat.JMSWireFormat is not registered.
and
2011-07-27 10:06:07,835 ERROR [org.jboss.remoting.transport.Connector] invalid Object Name
javax.management.InstanceNotFoundException: jboss.remoting:service=invoker,transport= socket,host=sudirman.nfsint.com,port=3873 is not registered.
But after running
ps ax | grep java
I cannot see any JBoss instance that still running. So I conclude that shutdowning has been done correcly. I will check the later issue when have time. Meanwhile those shutdowning command can be put into some script.
reference