Tomcat failure detect via shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Tomcat failure detect via shell
# 1  
Old 08-09-2017
Wrench Tomcat failure detect via shell

Team,
I am able to get ERROR message from my shell script, but sometime few severe error happen that tomcat server not started or not responding. How do we can detect it via shell script ?

here is my snippet I used for my case
Code:
  tail -n0 -F $catalinaPath | while read line; 
  do
  if echo $line && echo $line | grep -q 'Server startup' ; 
  then
              pkill -9 -P $$ tail > /dev/null 2>&1
              break
  fi
  done

This will basically checks if string "Server statup" found, it will assume server is started successfully, but what if that string is not found? my script will continue infinite time.

Is there any way we can track such thing via script?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Detect current shell inside a script

I wish to print my current shell which happens to be bash in my script check.sh more check.sh echo $0 echo `ps -p $$` But instead of printing it prints check.sh i.e the name of the script for both the commands. Can you please suggest how to print the current shell i m on inside the... (2 Replies)
Discussion started by: mohtashims
2 Replies

2. Shell Programming and Scripting

How to detect Hanged process in shell script?

I have to check daily 20 processes each day. The names are like Network1 Network2 Network3 ....... Network20. There is built in utility for doing this. Following is the command to check a single network process. check_process_status 1 If we want to check the status of Network2 then the... (6 Replies)
Discussion started by: Nakul_sh
6 Replies

3. Shell Programming and Scripting

Monitoring Tomcat Service with shell script

Hello Forum, I have prepared script to monitor the tomcat status. Following is the script which will monitor tomcat instance. I need little modifcation in the script. My script will grep for process, the output of grep command will analyze by if condition under for loop and will send... (2 Replies)
Discussion started by: ooilinlove
2 Replies

4. Shell Programming and Scripting

How to detect key press in cgi shell script?

I want to detect key pressed in my .cgi web page, but it does not work even I found the code in other web site. My code is : #!/bin/sh #================================================= # PATH defination # ================================================... (2 Replies)
Discussion started by: Shuinvy
2 Replies

5. Solaris

Tomcat..Unable to deploy application remotely in tomcat

Hi, We have upgrade tomcat from 5.0.20 to 7.0.33 and made changes to server.xml file according to newer version.. how ever the upgrade went fine and now i am unable to deploy application remotely.. it is giving 403 access denied error.. we have seperate appbase directory mentioned in server.xml..... (0 Replies)
Discussion started by: phani4u
0 Replies

6. Shell Programming and Scripting

Monitoring Tomcat Instance using shell script

Hello Forum, I have prepared script to monitor the tomcat status. Following is the script which will monitor tomcat instance.I need little modifcation in the script. My script will grep for java,the output of grep command will analyze by if condition under for loop and will send following echo... (7 Replies)
Discussion started by: coolguyamy
7 Replies

7. UNIX for Advanced & Expert Users

Shell to detect the end of file

Hi. I'm not UNIX expert, I need to do a shell to read a sequential file and show in the console the record numbers read, until the end of file. The reason of this shell is to be sure if the file is not corrupt. Thanks (1 Reply)
Discussion started by: hornam
1 Replies

8. Solaris

Detect Invalid Data by C shell

Dear all, I'd be so grateful if I could get great feedback again for my problems. We usually spool some text files from our system in csv format. Unfortunately, some data contains ',' (comma) and it's rare case but when it comes to spool, that row included comma should be invalid data, due... (2 Replies)
Discussion started by: elph
2 Replies

9. UNIX and Linux Applications

How to automatically detect command failure

I have a shell script. In this script I executes various command and my requirement is such that if any command fails I've to terminate the shell script. To achieve this objective I'm checking the value of $? after each command and if its value is greater thaen I 'exit' the script. Is there... (2 Replies)
Discussion started by: ashok2008
2 Replies

10. Shell Programming and Scripting

executing shell file in jva + tomcat

Colleagues, i have an jsp application which uses a servlet for controlling the request. the servlet uses a java class that will invoke a shell script. when i involked a shell script using java's runtime.exec command , it didnt work... applications used are tomcat5, Fedora 6 and java1.5.0_09... (1 Reply)
Discussion started by: jaganadh
1 Replies
Login or Register to Ask a Question
OCF_HEARTBEAT_TOMCAT(7) 					OCF resource agents					   OCF_HEARTBEAT_TOMCAT(7)

NAME
ocf_heartbeat_tomcat - Manages a Tomcat servlet environment instance SYNOPSIS
tomcat [start | stop | status | monitor | meta-data | validate-all] DESCRIPTION
Resource script for Tomcat. It manages a Tomcat instance as a cluster resource. SUPPORTED PARAMETERS
tomcat_name The name of the resource, added as a Java parameter in JAVA_OPTS: -Dname=<tomcat_name> to Tomcat process on start. Used to ensure process is still running and must be unique. (unique, optional, string, no default) script_log Log file, used during start and stop operations. (unique, optional, string, no default) tomcat_stop_timeout Time-out for stop operation. DEPRECATED (optional, integer, no default) tomcat_suspend_trialcount Maximum number of times to retry stop operation before suspending and killing Tomcat. DEPRECATED. Does not retry. (optional, integer, no default) tomcat_user The user who starts Tomcat. (optional, string, no default) statusurl URL for state confirmation. (optional, string, no default) java_home Home directory of Java. (required, string, no default) java_opts Java JVM options used on start and stop. (optional, string, no default) catalina_home Home directory of Tomcat. (unique, required, string, no default) catalina_base Instance directory of Tomcat (unique, optional, string, no default) catalina_pid A PID file name for Tomcat. (unique, optional, string, no default) tomcat_start_opts Tomcat start options. (optional, string, no default) catalina_opts Catalina options, for the start operation only. (optional, string, no default) catalina_rotate_log Rotate catalina.out flag. (optional, string, no default) catalina_rotatetime catalina.out rotation interval (seconds). (optional, integer, no default) SUPPORTED ACTIONS
This resource agent supports the following actions (operations): start Starts the resource. Suggested minimum timeout: 60s. stop Stops the resource. Suggested minimum timeout: 120s. status Performs a status check. Suggested minimum timeout: 60. monitor Performs a detailed status check. Suggested minimum timeout: 30s. Suggested interval: 10s. meta-data Retrieves resource agent metadata (internal use only). Suggested minimum timeout: 5s. validate-all Performs a validation of the resource configuration. Suggested minimum timeout: 5. EXAMPLE
The following is an example configuration for a tomcat resource using the crm(8) shell: primitive p_tomcat ocf:heartbeat:tomcat params java_home=string catalina_home=string op monitor depth="0" timeout="30s" interval="10s" SEE ALSO
http://www.linux-ha.org/wiki/tomcat_(resource_agent) AUTHOR
Linux-HA contributors (see the resource agent source for information about individual authors) resource-agents UNKNOWN 03/09/2014 OCF_HEARTBEAT_TOMCAT(7)