grep startup messages from catalina.out file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting grep startup messages from catalina.out file
# 1  
Old 12-22-2010
grep startup messages from catalina.out file

Hello Team,

I am trying to extract date from the following output and trying to compare with current date and if there is 10 minute difference between the two. it should logs message in the file server is started.can anyone help me to implement this in the script?

Quote:
bash-3.00$ grep -i startup catalina.out
Dec 19, 2010 3:28:36 PM org.apache.catalina.startup.Catalina load
Dec 19, 2010 3:28:39 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3258 ms
bash-3.00$
# 2  
Old 12-22-2010
With external modules you could write something cleaner:
Code:
perl -MTime::Local -lne'BEGIN {
    @m{qw[Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec]} = 0 .. 11;
  }
  @dt = split /[\s,:]/, $1 if /(.*) org.apache.catalina.startup.Catalina start/;

  END {
    time - timelocal $dt[6], $dt[5],
      $dt[4] = $dt[7] eq "PM" ? $dt[4] + 12 : $dt[4], $dt[1],
      $m{ $dt[0] }, $dt[3] > 600
      and print "More than 10 minutes from the last Tomcat startup";
    }' catalina.out

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. OS X (Apple)

MacOS 10.15 (Catalina) switches from bash to zsh

Interestingly Apple has decided to switch the default shell for new users from bash to zsh in MacOS Catalina (10.15) Use zsh as the default shell on your Mac - Apple Support Another interesting fact is that Catalina also comes with /bin/dash (5 Replies)
Discussion started by: Scrutinizer
5 Replies

2. UNIX for Beginners Questions & Answers

No init messages display during startup/shutdown

This question is more in the line of how init messages get sent to a console during startup/shutdown. My problem has to do with exporting a VM from AWS to KVM (and a retry on virtual box). I am looking for a understanding on how init messages are sent to a device and what controls them My two... (0 Replies)
Discussion started by: jtkells
0 Replies

3. Shell Programming and Scripting

Montioring Script Tomcat catalina.out

Hi, I need to monitor the tomcat log file called "Catalina.out" for any errors like out of memory,JDBC exceptions,broken pipe any other errors and exceptions The script should monitor this file and send a mail instantly and create a text file with errors day to day. Iam using Solaris... (3 Replies)
Discussion started by: chaithanyaa
3 Replies

4. UNIX and Linux Applications

Logrotate with catalina.out "daily compressed file is overwriting the logs"

Hi Everyone, We are trying to do a logrotate for "catalina.out" daily, So have used the "copytruncate" option in the logrotate configuration but ended up seeing there was a 0kb file touched with "catalina.out" and the other file with the current date(compressed) file created and seems the log is... (2 Replies)
Discussion started by: thiyagoo
2 Replies

5. Shell Programming and Scripting

Apache tomcat startup script not booting at startup.

I copied the script from an AskUbuntu post - #!/bin/bash ### BEGIN INIT INFO # Provides: tomcat7 # Required-Start: $network # Required-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start/Stop Tomcat server ### END INIT INFO ... (14 Replies)
Discussion started by: Hijanoqu
14 Replies

6. Solaris

Log Rotation of Catalina.out

Hi, Recently i received a request to rotate logs of catalina.out (tomcat). The file size was about 807 MB. I used logadm to truncate the log ( -c ) and zip (-z 0) it. Everything worked fine, catalina.out.0.gz was created (22 MB) and the size of original catalina.out became 0kb. After... (2 Replies)
Discussion started by: Mack1982
2 Replies

7. SuSE

How to record shutdown/startup messages

The wtmp file records all logins and logouts. Its format is exactly like utmp except that a null user name indicates a logout on the associated terminal. Furthermore, the terminal name "~" with user name "shutdown" or "reboot" indicates a system shutdown or reboot and the pair of terminal names... (1 Reply)
Discussion started by: Laksmi
1 Replies

8. Solaris

Catalina Analysis

How can I make analysis for catalina.out (2 Replies)
Discussion started by: Burhan
2 Replies

9. UNIX for Dummies Questions & Answers

Startup File

I am running Mandrake 8.1 and am wondering what file Linux uses to start services. Such as MySQLD and Apache. I need to add a program to this startup file so that it loads when linux loads. Thanks Gregg (3 Replies)
Discussion started by: gdboling
3 Replies
Login or Register to Ask a Question