Pascal: Thanks for the detailed explanation,
The procedure I used to launch jsvc Login in SERVER using root account through SSH. Go to TOMCAT directory, Run startTomcat.sh, nothing happened. Then run command cat startTomcat.sh and copy/paste the command to the console, hit enter. Tocmat started after verifying the netstat -nlp | grep jsvc I setup all the environment variable like inside Catalina.sh By adding 4 echo in my startTomcat.sh " echo "JAVA_HOME: $JAVA_HOME" echo "CATALINA_HOME: $CATALINA_HOME" echo "CATALINA_BASE: $CATALINA_BASE" echo "CATALINA_TMPDIR: $CATALINA_TMPDIR" ./bin/jsvc -jvm server -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8000,suspend=n,server=y -Djava.endorsed.dirs=./common/endorsed -cp ./bin/bootstrap.jar -outfile ./logs/catalina.out -errfile ./logs/catalina.err org.apache.catalina.startup.Bootstrap [EMAIL PROTECTED] tomcat]# ./bin/jsvc -jvm server -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8000,suspend=n,server=y -Djava.endorsed.dirs=./common/endorsed -cp ./bin/bootstrap.jar -outfile ./logs/catalina.out -errfile ./logs/catalina.err org.apache.catalina.startup.Bootstrap " What is going on here? Thanks Pat -----Original Message----- From: Pascal Bleser [mailto:[EMAIL PROTECTED] Sent: Friday, September 01, 2006 9:09 AM To: Tomcat Users List Subject: Re: Why cannot I put JSVC into a shell script to run Patrick Wang wrote: > Thanks for the reply, you are correct. The same command line doesnot work when I > put into a shell command. I used the command netstat to see if Tomcat has > started since it listen to the port. Rather use lsof -i instead of netstat + having to grep the output: if lsof -i:8080 &>/dev/null; then # something is listening on 8080 else # nothing is listening on 8080 fi Another approach is to use netcat in "zero I/O mode" to make a TCP connect on the port: if netcat -n -w 1 -z localhost 8080; then # something responds to connect on 8080 else # nothing responds to connect on 8080 fi N.B.: -n is to avoid host and protocol name lookups -w 1 is to set the timeout for the connect to 1 second -z is for "zero I/O mode" -- i.e. just connect() and close > Command from console works, starting shell script not working without an error > shown up on the console. Just a wild guess: what about your JAVA_HOME, JRE_HOME and other environment variables that affect Tomcat ? Are you starting that shell script from the same environment as when you do it with the command, directly ? Same environment means: same user, also from an interactive shell, etc... If, for example, that shell script is being started by init as root, you will end up having a totally different environment as when you log in into an interactive shell. > Since I am new to the bash shell script, I am not sure how to debug it. bash -x ./my_script.sh > I checked the catalina.err, it seems cannot find a file, classpath was not > setup? But everything in the console works great. Could the environment on the > console and shell script different? See above. Personally, I always setup the full environment (well, at least the environment variables that affect Tomcat) in bin/setenv.sh If that file exists, it will automatically be sourced by catalina.sh That's where you should do your environment settings, especially JAVA_HOME and JRE_HOME. Do not rely on the environment as it is setup by an interactive login (e.g. ~/.profile or ~/.bashrc) e.g. ---8<------------------------------- JAVA_HOME=/usr/java/jdk1.5.0 JRE_HOME=$JAVA_HOME JAVA_OPTS="-Xms128m -Xmx128m" PATH=$JAVA_HOME/bin:$PATH export JAVA_HOME JRE_HOME ---8<------------------------------- cheers -- -o) Pascal Bleser ATOS Worldline/Aachen(DE) /\\ System Architect WLP Business Platform _\_v "Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect."-L.Torvalds --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]