File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Tomcat move from Windows to Linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat move from Windows to Linux" Watch "Tomcat move from Windows to Linux" New topic
Author

Tomcat move from Windows to Linux

John Farrel
Ranch Hand

Joined: May 24, 2010
Posts: 83

We are in the process of moving a bunch of tomcat 7 apps from windows to linux.

We also have a java app that controls and deploys new builds to these tomcat installations.
Currently the java app runs on a windows box and uses sc to shutdown/restart the tomcat windows service.
I know tomcat has it's own web manager, but we have found it to be pretty unreliable, which is why we deploy by stopping the web server at the OS level, updating then restarting.

The question I have is;

If we run tomcat as a respawning daemon on linux, is there a way to manage it as a service in the same way I can with windows?
I would need to be able to remotely shutdown the service (update the war) and start it up again.


Saif Asif
Ranch Hand

Joined: Aug 11, 2011
Posts: 440

Hi John,

Yes it is possible to run tomcat as a service . You just need toTake a look at this article which explains step by step on how to configure tomcat as a service on a Linux box Link . You can remotely ssh into your linux server and then start/stop the tomcat service with just a single command from anywhere. To automate the process, you can write a bash script which stops the service, updates the war for you and then restarts the tomcat service.

Muhammad Saif Asif Mirza
OCJA(5/6) OCJP(6) OCJWCD(6)
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

Note that if you literally mean "respawn" as in /etc/inittab, I don't recommend that. Very few system components have the necessary attributes to warrant an inittab respawn. Respawns can effectively eat your machine.

Tomcat is normally set up as a system service, which means that it's usually managed via an init script.


Customer surveys are for companies who didn't pay proper attention to begin with.
K. Gil
Ranch Hand

Joined: Apr 29, 2011
Posts: 75

If we run tomcat as a respawning daemon on linux, is there a way to manage it as a service in the same way I can with windows?
I would need to be able to remotely shutdown the service (update the war) and start it up again.


can't see any problems here

Tomcat is normally set up as a system service, which means that it's usually managed via an init script.


at least it should be
mostly it is when you install tomcat from OS repositories, which comes with init script, but when you download tomcat package and drop it to your home dir, it doesn't.
also, in some cases you don't have root access to your server to install init scripts.

anyway, I can't see a problem with using standard tomcat's startup/shutdown scripts.

so simply upload war, ssh and execute shutdown/startup and it's done. you can even script that, easy

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

I did make certain assumptions. Since it was a Service under Windows and similar level of operation was expected for Linux, I took it as given that admin rights would be inherent in the installation process. The closest approximation to the Windows Service Manager would be the init subsystem (historically, anyway. New stuff is beginning to move in). I write my own initscripts, since I don't install Tomcat via OS package management.

When you're running Tomcat as a ordinary (non-daemon) user, you wouldn't have that luxury as a rule, of course.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat move from Windows to Linux
 
Similar Threads
Get String from servlet
Tomcat service on Windows 7 - Cannot access web app from remote computer
Servlet Running in Infinite loop
Installation Guide (Tomcat on Linux)
How to schedule tomcat at system startup windows