Shell script to capture a value from the log file and initiate some action based on that


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Shell script to capture a value from the log file and initiate some action based on that
# 1  
Old 03-25-2020
Shell script to capture a value from the log file and initiate some action based on that

Hi - I have korn script to execute a oracle job to process a data file . Here in the shell script we are a capturing all the activities in a log file(LOG_File) and we are capturing the record count like no of gets processed and rejected(variable in log file "Num of rejected records:" ). I'd like to trigger an email to the team when the total rejected record is more than 1.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Script to capture logs based on REQUEST iD

Hi All, I am a newbie, I am looking for a script that can capture logs based on a request id and store it in tmp folder Log files looks like this" - 2015-07-08 10:59:17,100 INFO RequestId -> 923559008 Inside test method - 2015-07-08 10:59:17,100 INFO RequestId -> 923559008 End of... (2 Replies)
Discussion started by: tsingh
2 Replies

2. Shell Programming and Scripting

Help on script to capture info on log file for a particular time frame

Hi I have a system running uname -a Linux cmovel-db01 2.6.32-38-server #83-Ubuntu SMP Wed Jan 4 11:26:59 UTC 2012 x86_64 GNU/Linux I would like to capture the contents of /var/log/syslog from 11:00AM to 11:30AM and sent to this info via email. I was thinking in set a cron entry at that... (2 Replies)
Discussion started by: fretagi
2 Replies

3. Shell Programming and Scripting

Script to capture string in a log file

Dear all, I have a log file to be analysed. this log file contains vaiours lines of code starting with date timestamp. if my search string is exception then that resepective log statement starting from the date is required. example: 2014/10/01 16:14:44.459|>=|E|X|19202496|2832|... (5 Replies)
Discussion started by: shravee
5 Replies

4. Shell Programming and Scripting

Shell script to capture Current day ORA errors from Alert Log

Please provide Shell script to capture ORA errors from Alert Log for a given date or Current date. -Veera (1 Reply)
Discussion started by: Veera_V
1 Replies

5. Shell Programming and Scripting

HELP: Shell Script to read a Log file line by line and extract Info based on KEYWORDS matching

I have a LOG file which looks like this Import started at: Mon Jul 23 02:13:01 EDT 2012 Initialization completed in 2.146 seconds. -------------------------------------------------------------------------------- -- Import summary for Import item: PolicyInformation... (8 Replies)
Discussion started by: biztank
8 Replies

6. Shell Programming and Scripting

Moving log files based on month - help with ksh shell script

Hello, I'm trying to move the log files from the parent directory to respective monthly folder and I would be running this script on a weekly basis through cron. I'm new to this scripting and here is what i could come up and it runs without really doing anything. I even tried placing echo... (2 Replies)
Discussion started by: jusblues
2 Replies

7. Shell Programming and Scripting

Shell script to capture ORA errors from Alert Log

Hi, as the title says, I am after a simple script, which will open the Alert log from an 11.2.0.1 Linux environment and mail the error message and description to a recipient email address. I can then schedule this job via cron and let it run every 15 minutes. I have searched online... (16 Replies)
Discussion started by: jnrpeardba
16 Replies

8. Shell Programming and Scripting

Shell script to find the run time based on log entries?

Shell script to find the run time based on log entries? Below is the log files content updated when the script test.sh runs. I would like to calculte the difference between first update time stamp and last update time stamp to find the run time of the script. The below log file shows the first... (1 Reply)
Discussion started by: mailtopranesh
1 Replies

9. Shell Programming and Scripting

shell script - search a file and perform some action

hi, i have a service on unix platform, it will generate traces in a particular folder i want to check using shell script if traces exist, then perform some action else continue to be in loop. filename is service.tra can you please help? thanks (4 Replies)
Discussion started by: gauravah
4 Replies

10. 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
Login or Register to Ask a Question
SCRIPT(1)							   User Commands							 SCRIPT(1)

NAME
script - make typescript of terminal session SYNOPSIS
script [options] [file] DESCRIPTION
script makes a typescript of everything displayed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1). If the argument file is given, script saves the dialogue in this file. If no filename is given, the dialogue is saved in the file type- script. OPTIONS
-a, --append Append the output to file or to typescript, retaining the prior contents. -c, --command command Run the command rather than an interactive shell. This makes it easy for a script to capture the output of a program that behaves differently when its stdout is not a tty. -e, --return Return the exit code of the child process. Uses the same format as bash termination on signal termination exit code is 128+n. -f, --flush Flush output after each write. This is nice for telecooperation: one person does `mkfifo foo; script -f foo', and another can supervise real-time what is being done using `cat foo'. --force Allow the default output destination, i.e. the typescript file, to be a hard or symbolic link. The command will follow a symbolic link. -q, --quiet Be quiet (do not write start and done messages to standard output). -t[file], --timing[=file] Output timing data to standard error, or to file when given. This data contains two fields, separated by a space. The first field indicates how much time elapsed since the previous output. The second field indicates how many characters were output this time. This information can be used to replay typescripts with realistic typing and output delays. -V, --version Display version information and exit. -h, --help Display help text and exit. NOTES
The script ends when the forked shell exits (a control-D for the Bourne shell (sh(1)), and exit, logout or control-d (if ignoreeof is not set) for the C-shell, csh(1)). Certain interactive commands, such as vi(1), create garbage in the typescript file. script works best with commands that do not manipulate the screen, the results are meant to emulate a hardcopy terminal. It is not recommended to run script in non-interactive shells. The inner shell of script is always interactive, and this could lead to unexpected results. If you use script in the shell initialization file, you have to avoid entering an infinite loop. You can use for example the .profile file, which is read by login shells only: if test -t 0 ; then script exit fi You should also avoid use of script in command pipes, as script can read more input than you would expect. ENVIRONMENT
The following environment variable is utilized by script: SHELL If the variable SHELL exists, the shell forked by script will be that shell. If SHELL is not set, the Bourne shell is assumed. (Most shells set this variable automatically). SEE ALSO
csh(1) (for the history mechanism), scriptreplay(1) HISTORY
The script command appeared in 3.0BSD. BUGS
script places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects. script is primarily designed for interactive terminal sessions. When stdin is not a terminal (for example: echo foo | script), then the session can hang, because the interactive shell within the script session misses EOF and script has no clue when to close the session. See the NOTES section for more information. AVAILABILITY
The script command is part of the util-linux package and is available from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils /util-linux/>. util-linux June 2014 SCRIPT(1)