• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Tomcat move from Windows to Linux

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.


 
Ranch Hand
Posts: 440
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 20995
128
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 75
Tomcat Server Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Bartender
Posts: 20995
128
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
See where your hand is? Not there. It's next to this tiny ad:
professionally read, modify and write PDF files from Java
https://products.aspose.com/pdf/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!