Start and shutdown tomcat via ssh
Posted
by
bxshi
on Server Fault
See other posts from Server Fault
or by bxshi
Published on 2012-09-18T07:48:15Z
Indexed on
2012/09/18
9:39 UTC
Read the original article
Hit count: 454
Updated
I find out that the path of jdk it using is wrong. eval: 1: /opt/Java/jdk1.6.0_25/jre/bin/java: not found
the Java
should be lower case java
, how is that happen? When I run this script directly on server, it is just okay.
I'm trying to start or shutdown tomcat via a remote client.
On my server, I've got 3 different tomcat: tomcat1, tomcat2, and tomcat3.
Firstly, I've tried to run tomcat_path/bin/shutdown.sh
to stop it via ssh, and the command is
ssh [email protected] "cd /home/jake/tomcat2/bin;exec bash ./shutdown.sh"
both "
and '
are tried, but do not work, the output is
eval: 1: /opt/Java/jdk1.6.0_25/jre/bin/java: not found
it seems that the shell script runs on my local client, because on server it has this file.
Is there any way to run a shell script on remote server correctly?
updated
I've run
ssh [email protected] "sh -x /home/jake/tomcat/bin/shutdown.sh > /home/jake/tomcat.log 2>&1"
and the output in tomcat.log is :
+ PRG=/home/jake/tomcat/bin/shutdown.sh
+ [ -h /home/jake/tomcat/bin/shutdown.sh ]
+ dirname /home/jake/tomcat/bin/shutdown.sh
+ PRGDIR=/home/jake/tomcat/bin
+ EXECUTABLE=catalina.sh
+ [ ! -x /home/jake/tomcat/bin/catalina.sh ]
+ exec /home/jake/tomcat/bin/catalina.sh stop
eval: 1: /opt/Java/jdk1.6.0_25/jre/bin/java: not found
© Server Fault or respective owner