• 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

Starting Tomcat then closing the shell.

 
Ranch Hand
Posts: 643
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Simple question but I cant seem to find the answer on Google. I am starting tomcat on a linux box using catalina.bat jpda run this is great for development.
But now I need to start tomcat, and close the shell I use.

Uisng catalina.bat jpda run if I close the shell it stops the tomcat instance.

Would I be right in thinking I should be using catalina.bat jpda start.

Thanks for any help.
 
Saloon Keeper
Posts: 23409
159
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's a couple of problems with that statement. First, "jpda" is a debugging option, so you would only use it while testing with a remote debugger.

More importantly, though, you can't use a ".bat" file to run scripts in Linux. Tomcat uses ".sh" files for that.

I don't think any of the script options will do what you want, though. You want to run Tomcat as a dæmon. These days that means you'd usually use the OS systemd resource management subsystem to start and stop Tomcat.

Unfortunately, the systemd file doesn't come with Tomcat, but here's a typical implementation:

https://gist.github.com/drmalex07/e6e99dad070a78d5dab24ff3ae032ed1
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A few questions for you:

Are you using a GUI like Gnome maybe? or is this from a headless terminal?

How are you opening the shell you're using to run catalina.sh (I have to assume you're using catalina.sh instead of catalina.bat if you're on a Linux server)? Are you calling this from an IDE perhaps?

What is the command exactly you're using to start catalina?

On a Linux system you can use something called nohup to run something in the background and close the tty you're using to call it but that isn't always necessary.
 
Tim Holloway
Saloon Keeper
Posts: 23409
159
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Harlin Seritt wrote:
On a Linux system you can use something called nohup to run something in the background and close the tty you're using to call it but that isn't always necessary.



The screen utility is also good for stuff like that. I use it to run the Hercules mainframe emulator, for example.

But as a general rule, if you're planning to run Tomcat as an ongoing service, the best way to run it is as a system service daemon.
 
I'm not sure if I approve of this interruption. But this tiny ad checks out:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic