Simple-Solution
Simple-Solution

Reputation: 4289

Connect to remote server and start/stop the Tomcat that's running on that particular server using Ant?

The purpose is to:

  1. connect to a remote server maybe via host: ip , port: 8181
  2. stop Tomcat that's running on that server
  3. deploy a .war file
  4. restart Tomcat

Underneath are few approaches I have taken so far to achieve this task:

Approaches taken so far:

I have looked at the following solutions but none of them worked for me:

  1. http://www.linuxquestions.org/questions/linux-newbie-8/start-tomcat-server-remotely-824472/ --Not efficient
  2. http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html#Start_an_Existing_Application
  3. http://raibledesigns.com/wiki/Wiki.jsp?page=TomcatAntTasks --only start/stop application not the actual tomcat itself
  4. http://cargo.codehaus.org/Remote+Container -- Which does't start/stop tomcat that's running on that server

Upvotes: 1

Views: 5791

Answers (2)

Count
Count

Reputation: 1423

For start/stop tomcat

In linux environment use SSH to reach the terminal of the remote machine. from the terminal You can start/stop the tomcat

to start startup.sh to stop shutdown.sh

Under windows environment

Install OpenSSHD for Windows - this will allow remote "console" sessions.

If you looking for something very "unix-like" then you can install cygwin.

http://www.worldgoneweb.com/2011/installing-openssh-on-windows-7/

to start startup.bat to stop shutdown.bat

For deployment

Simply go to tomcat manager link on the below page(on any environment)

http://your_server_ip:port_number/

user credential are specified in tomcat-users.xml inside conf di

Upvotes: 0

Edwin Dalorzo
Edwin Dalorzo

Reputation: 78619

If you have ssh access to the server, then you might like to consider the JSch library which you can use in combination with SSHExec Ant Task to start and stop your server:

<sshexec host="somehost"
    username="dude"
    password="yo"
    command="/etc/init.d/tomcat restart"/>

Upvotes: 1

Related Questions