How do I Start JBoss automatically when boot my linux machine.

Script already goes to bin dir :wink:

 
........
cd /home/argole/server/jboss-4.2.0.GA/bin
.........

insert this lines in your /etc/profile (Red Hat Based or Kernel 2.6.30.X)

export PATH=/home/argole/jdk/jdk1.6.0_10
export JAVA_HOME=/home/argole/server/jboss-4.2.0.GA/bin

or /etc/environment (Debian Based - Kernel 2.6.10.X)

export PATH=/home/argole/jdk/jdk1.6.0_10
export JAVA_HOME=/home/argole/server/jboss-4.2.0.GA/bin

close and open again the CLI (terminal) and execute:

./run.sh -b 0.0.0.0 -c projectfolder &

Im using this script
---------------------------------

#!/bin/sh
# For starting Jboss

JAVA_HOME=/home/argole/jdk/jdk1.6.0_10
JBOSS_HOME=/home/argole/server/jboss-4.2.0.GA

export JAVA_HOME
export JBOSS_HOME

cd /home/argole/server/jboss-4.2.0.GA/bin
echo "Starting JBOSS server"

nohup ./run.sh -b 0.0.0.0 -c default

#nohup ./run.sh -c projectfolder > JBoss.log 2>&1 &
sleep 180
exit

----------------------------------------------

and the out put of ur suggestion is

=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /home/argole/server/jboss-4.2.0.GA

  JAVA: /home/argole/jdk/jdk1.6.0_10//bin/java

  JAVA_OPTS: -Dprogram.name=run.sh -server -Xms1024m -Xmx2048m -XX:NewSize=512m -XX:MaxNewSize=512m -XX:PermSize=384m -XX:MaxPermSize=512m -XX:-UseGCOverheadLimit -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djava.net.preferIPv4Stack=true

  CLASSPATH: /home/argole/server/jboss-4.2.0.GA/bin/run.jar:/home/argole/jdk/jdk1.6.0_10//lib/tools.jar

=========================================================================

17:56:07,100 INFO  [Server] Starting JBoss (MX MicroKernel)...
17:56:07,133 INFO  [Server] Release ID: JBoss [Trinity] 4.2.0.GA (build: SVNTag=JBoss_4_2_0_GA date=200705111440)
17:56:07,135 INFO  [Server] Home Dir: /home/argole/server/jboss-4.2.0.GA
17:56:07,135 INFO  [Server] Home URL: file:/home/argole/server/jboss-4.2.0.GA/
17:56:07,136 INFO  [Server] Patch URL: null
17:56:07,136 INFO  [Server] Server Name: projectfolder
17:56:07,136 INFO  [Server] Server Home Dir: /home/argole/server/jboss-4.2.0.GA/server/projectfolder
17:56:07,137 INFO  [Server] Server Home URL: file:/home/argole/server/jboss-4.2.0.GA/server/projectfolder/
17:56:07,137 INFO  [Server] Server Log Dir: /home/argole/server/jboss-4.2.0.GA/server/projectfolder/log
17:56:07,137 INFO  [Server] Server Temp Dir: /home/argole/server/jboss-4.2.0.GA/server/projectfolder/tmp
17:56:07,138 INFO  [Server] Root Deployment Filename: jboss-service.xml
17:56:08,323 INFO  [ServerInfo] Java version: 1.6.0_10-rc,Sun Microsystems Inc.
17:56:08,323 INFO  [ServerInfo] Java VM: Java HotSpot(TM) Server VM 11.0-b15,Sun Microsystems Inc.
17:56:08,323 INFO  [ServerInfo] OS-System: Linux 2.6.25-14.fc9.i686,i386
17:56:09,359 INFO  [Server] Core system initialized
Failed to boot JBoss:
org.jboss.deployment.DeploymentException: url file:/home/argole/server/jboss-4.2.0.GA/server/projectfolder/conf/jboss-service.xml could not be opened, does it exist?
	at org.jboss.deployment.DeploymentInfo.<init>(DeploymentInfo.java:214)
	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:781)
	at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
	at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
	at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
	at $Proxy5.deploy(Unknown Source)
	at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
	at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
	at org.jboss.Main.boot(Main.java:200)
	at org.jboss.Main$1.run(Main.java:508)
	at java.lang.Thread.run(Thread.java:619)
17:56:09,436 INFO  [Server] Runtime shutdown hook called, forceHalt: true
17:56:09,436 INFO  [Server] JBoss SHUTDOWN: Undeploying all packages
17:56:09,443 INFO  [Server] Shutdown complete
Shutdown complete
Halting VM

because
conf/jboss-service.xml file is not in this path this file is, can i copy past that directory on this location ?

Your production directory must be like this and best way you must preapere to this form without change default env definitions :wink:

 
# ls -l /home/argole/server/jboss-4.2.0.GA/server/
 
lrwxrwxrwx 1 jboss jboss 20 Jun 16 17:46 conf -> /etc/jbossas/projectfolder
drwxr-xr-x 2 jboss jboss 4096 Apr 21 02:59 data
drwxr-xr-x 2 jboss jboss 4096 Apr 21 02:57 deploy
drwxr-xr-x 2 jboss jboss 4096 Jun 16 17:46 lib
lrwxrwxrwx 1 jboss jboss 24 Jun 16 17:46 log -> /var/log/jbossas/projectfolder
drwxr-xr-x 2 jboss jboss 4096 Apr 21 02:59 tmp
drwxr-xr-x 2 jboss jboss 4096 Apr 21 02:59 work

and

 
# ls -l  /etc/jbossas/projectfolder
 
-rw-r--r-- 1 jboss jboss  16191 Apr 21 02:57 jacorb.properties
-rw-r--r-- 1 jboss jboss   9000 Apr 21 02:57 jbossjta-properties.xml
-rw-r--r-- 1 jboss jboss  11678 Apr 21 02:57 jboss-log4j.xml
-rw-r--r-- 1 jboss jboss   7595 Apr 21 02:57 jboss-minimal.xml
-rw-r--r-- 1 jboss jboss  37304 Apr 21 02:57 jboss-service.xml
-rw-r--r-- 1 jboss jboss    194 Apr 21 02:57 jndi.properties
-rw-r--r-- 1 jboss jboss   6472 Apr 21 02:57 login-config.xml
drwxr-xr-x 2 jboss jboss   4096 Jun 16 17:46 props
-rw-r--r-- 1 jboss jboss 116976 Apr 21 02:57 standardjbosscmp-jdbc.xml
-rw-r--r-- 1 jboss jboss  71099 Apr 21 02:57 standardjboss.xml
drwxr-xr-x 2 jboss jboss   4096 Jun 16 17:46 xmdesc
 

I have these mentioned directories when ls
[root@cat12 server]# ls
all default minimal projectfolder

[root@cat12 server]# cd projectfolder/
[root@cat12 projectfolder]# ls
log tmp

Hi shiraz

# cd /home/argole/server/jboss-4.2.0.GA/server/
# cp -r minimal/* projectfolder/

then run your script ok :b:

regards
ygemici