2

I started a Tomcat7 user instance with tomcat7-instance/bin/startup.sh, but how can I chek if that instance is running or not? Of course, an easier way than with ps | grep.

I know that to check the service status you can use service tomcat7 status, but this is an user instance.

I'm using Ubuntu 12.10 and 13.10.

Adrian Ber
  • 305
  • 2
  • 5
  • 16

1 Answers1

2

If you installed from repositories then service tomcat7 status should work. Or /etc/init.d/tomcat7 status:

My output from running either of the above commands is below:

Tomcat servlet engine is running with pid 14416.

The way that debian checks is by the below command:

start-stop-daemon --test --start --pidfile /var/run/tomcat7.pid --user tomcat7 --exec /usr/bin/java >/dev/null 2>&1; echo $?

If the value returned is anything but 0 then tomcat is running.

  • Is your OS Redhat/Centos? Do you use 3rd party repo, because with official Redhat repo there is no tomcat7 package – Shâu Shắc Nov 07 '13 at 03:59
  • The problem is that I want to check this for a tomcat user instance not the service itself. – Adrian Ber Nov 07 '13 at 09:53
  • When I try `sudo service tomcat8 status` I get `.. [OK]` as a response...what's happening? I am running an Amazon Linux AMI – mFeinstein Apr 10 '17 at 00:44
  • I am using sysvinit, I got whats going on, the script has a bug, it calls `success` which prints [ OK ] in the same line as the console. It's supposed to have an echo after the success command to change lines and print the green OK after some text – mFeinstein May 02 '17 at 17:41