Sponsored Content
Top Forums Shell Programming and Scripting How to capture the cause of the exception using unix shell? Post 302531569 by vidhyaS on Friday 17th of June 2011 07:42:53 AM
Old 06-17-2011
How to capture the cause of the exception using unix shell?

Hi all,

Can u pls guide me in the following requirement,

Am capturing the exceptions and the cause of that exception from a log file.

i cud capture the exceptions by simple grep ie., with the following command

cat logfile | grep "Exceptions"

But i couldn't able to capture the cause of that exception. this cause of the exception line can be identified by a pattern "msg=" which occurs before that "Exceptions" occurence.

The thing is if i put `egrep "Exceptions" | "msg="` then it finds all the occurences of "msg=" which is indeed not necessary. i need only the "msg=" occurence line(along with the exceptions) which is found before the "Exceptions" pattern line.

Thanks in Advance!! Please help on this...
 

10 More Discussions You Might Find Interesting

1. Programming

Exception Signal 11 while running JAVA code in UNIX

Hi, when i compile my java code in UNIX using javac, the class file is getting created. But when i try to run the code using java - classpath command, i get the following error. ---------------------------------------- /u/up11/sample/request:>java -classpath /u/up11/sample/request... (0 Replies)
Discussion started by: satish2712
0 Replies

2. Shell Programming and Scripting

Exception-handling in Shell programs

Hi all, I am writing a set of scripts and some of these are nested within others. I want to be able to execute a single high-level script at the command-line, which in turn may invoke other scripts as required, and when a failure occurs in any of the nested scripts, I want to be able to track... (2 Replies)
Discussion started by: chaitu_inmage
2 Replies

3. Shell Programming and Scripting

Capture Shell Script Output To A File

Hi, I am running a shell script called dbProcess.sh which performs shutdown and startup of various Oracle instances we have.At the time of execution the script produces the following output to the command line window $./dbProcess.sh stop #### Run Details ###### Hostname : server-hop-1... (4 Replies)
Discussion started by: rajan_san
4 Replies

4. Shell Programming and Scripting

Capture commands in unix SunOS

Hi, I would like to capture commands on Unix SunOS. I am aware of script utility but the problem is Script utility writes to file after a sizeable chunk of data. I need to access each command as they are typed, Is it possible in Unix..? Thx (1 Reply)
Discussion started by: raj_paps
1 Replies

5. Shell Programming and Scripting

How to capture RC from SAS Program into K-shell

I am running a SAS program within K-shell. This SAS program gives me return code of 3000. However, when I check return code in my K-shell, it displays RC=2. Can someone tell me how to capture RC from SAS to K-shell? Thanks. Pramodini (2 Replies)
Discussion started by: Pramodini Rode
2 Replies

6. Shell Programming and Scripting

Capture makefile errors in shell script

Hi, I have a bash script which calls a few "make". I would like to know whether the makefile failed with any errors. How do I do that in the script? Thanks, S (2 Replies)
Discussion started by: suryaemlinux
2 Replies

7. Shell Programming and Scripting

Shell script to unmonitor the mounts in exception file

I am trying to write a shell script for monitoring the file system mount. command I am using will retrieve a output as shown below. /dev/fsv29 2% /apps/rj/pgl/bslSys I also need to add exception mounts in a file and I would like script to ignore the mount which I specify. If I add the... (6 Replies)
Discussion started by: chandu123
6 Replies

8. Shell Programming and Scripting

How to Capture a Unix Terminal Session?

Hi All, I want to capture all the operations performed in the terminal. So to achieve this I used “script” command. This works as I expected. But this command captures all the standard output which is redirected to terminal. For example if i “tail” a file, even the tail output is getting... (2 Replies)
Discussion started by: kalpeer
2 Replies

9. Shell Programming and Scripting

Monitor logs for exception and if exception come then sent an email

Hi Folks, please advise , I have logs generated on unix machine at location /ops/opt/aaa/bvg.log , now sometimes there come exception in these logs also, so I want to write such a script such that it should continuously monitor these logs and whenever any exception comes that is it try to find... (3 Replies)
Discussion started by: tuntun27272727
3 Replies

10. Shell Programming and Scripting

Shell Script to Capture a Screenshot

Hi All, Suppose I want to take a screenshot of a website say Google and save that image. How should I do it? I tried wget with this but of no help. It just makes a particular file in jpeg format but on opening the same it says corrupted. Although I can edit the jpeg as an HTML file. wget... (15 Replies)
Discussion started by: ankur328
15 Replies
RoPkg::Exceptions(3pm)					User Contributed Perl Documentation				    RoPkg::Exceptions(3pm)

NAME
RoPkg::Exceptions - exceptions used by RoPkg packages DESCRIPTION
RoPkg::Exceptions is a collection of predefined exceptions used by all modules from RoPkg namespace. SYNOPSIS
#!/usr/bin/perl use strict; use warnings; use RoPkg::Exceptions; sub main { eval { if ( $#ARGV == -1 ) { Param::Missing->throw('No parameter found'); } }; if ( my $e = Exception::Class->caught('Param::Missing') ) { print STDERR $e->message,$/,$e->trace,$/; } } main(); It is very possible that you don't find a good reason for using exceptions from this example. And you are right. This example is kind of silly. But, try to use exceptions in a real project. Then, you will apreciate their real value. DEPENDENCIES
RoPkg::Exceptions require perl 5.008 or later and the Exception::Class module. Exceptions List The following exceptions are defined in this class: *) General - general pourpose exception *) OutsideClass - raised when a method is called outside a class instance *) File - the base for all file related exceptions . This exception has the filename parameter, who can be used to specify the path to the file. filename parameter can be used by all derivated exceptions. The following exceptions are derivated from File: *) File::NotFound - the file was not found *) File::Open - error while opening file *) File::Create - could not create file *) Dir - the base for all directory related exceptions . This exception has the dirname parameter, who can be used to specify the path to the directory. dirname parameter can be used by all derivated exceptions. The following exceptions are derivated from Dir: *) Dir::NotFound - the directory was not found *) Dir::Open - error while opening directory *) Dir::Create - could not create directory *) Param - the base for all parameters related exceptions. This exception has the name parameter, who can be used to specify the parameter name. name can be used by all derivated exceptions. The following exceptions are derivated from Param: *) Param::Missing - the parameter was not found *) Param::Unknown - the parameter is unknown *) Param::Wrong - the parameter has the wrong value or is not defined *) DB - the base for all database related exceptions. This exception has the following parameters: dsn, user and pass . This exception (and the ones derivated from her) are mostly used in RoPkg::DB class. Of course, this doesn't means that you can't use them in your application ;) .The following exceptions are derivated from DB: *) DB::Connect - raised when the connection with the database could not be established *) DB::ConnExists - raised when a connection with the same name already exists. *) DB::ConnNotFound - the requested connection was not found *) DB::NoResults - the sql query returned no results Exceptions Tree ROOT General OutsideClass File File::NotFound File::Open File::Create Dir Dir::NotFound Dir::Open Dir::Create Param Param::Missing Param::Unknown Param::Wrong DB DB::Connect DB::ConnExists DB::ConnNotFound DB::NoResults SEE ALSO
RoPkg::Utils AUTHOR
Subredu Manuel <diablo@iasi.roedu.net> VERSION
The current version is 0.2.1 DIAGNOSTICS
The tests for this module are located in t directory. To run those tests, use the following command: make test SUBROUTINES
/METHODS This module does not have any public methods. INCOMPATIBILITIES
None known to me PERL CRITIC
This module is perl critic level 1 compliant with 1 exception. BUGS AND LIMITATIONS
No known bugs. If you find one (or many) please send me a detailed report. CONFIGURATION AND ENVIRONMENT
No configuration file or environment variables are used by this module. LICENSE AND COPYRIGHT
Copyright (C) 2005 Subredu Manuel. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The LICENSE file contains the full text of the license. perl v5.8.8 2006-06-09 RoPkg::Exceptions(3pm)
All times are GMT -4. The time now is 07:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy