Sponsored Content
Top Forums Shell Programming and Scripting script to match statement from a file Post 302548918 by anshu ranjan on Friday 19th of August 2011 05:40:57 PM
Old 08-19-2011
script to match statement from a file

All,

I am trying to write a script which will match the statement from one log file and then proceed for other commands mention in the script.

for my application, backup is schedule to run every day at particular time and creats a log file "/var/adm/backuplog".
if backup completes then last line of this log file will be as below if backup completes on 19th aug
"08/19/2011 11:57:53 Backup has been completed."

this log file is incrimental file, so we can find "Backup has been completed" statement multiple times but with 19th date only one.

Now I want to write a script to check backup completed or not and my require file has been backedup or not. this script will match the last line with current date from the backuplog file. if this script finds that last line says "Backup has been completed" with current date then it will proceed further to check other commands or it will send mail saying that "Either backup has been failed or it is still running"

Could any one please help me, how to write this script?


Thanks,
Anshu
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

if statement to match *

Hi I have a script like read i if then echo bingo fi I want to enter the if block if i is equal to * The same doesn't happen , when I input * the script fails with error "[: too many arguments" I know it is very basic , but still Could any one help me out with the issue ... (3 Replies)
Discussion started by: sivasenthil_k
3 Replies

2. UNIX for Dummies Questions & Answers

Regex in if-then-else statement to match strings

hello I want to do a pattern match for string in the if statement, but I am not sure how to use regex inside the if statement. I am looking for something like this: if {2,3} ]; then ..... .... ... fi (7 Replies)
Discussion started by: rakeshou
7 Replies

3. Shell Programming and Scripting

How to match the last XML extension by using Case statement

Hi All, I have a status.txt file which contains following three files. 1.xml 2.xml 3.xml Now i have written a shell script 1.sh which contains the following cat status.txt | while read filename do echo $filename case "$filename" in xml) echo "running 1.xml" ;; ... (3 Replies)
Discussion started by: sunitachoudhury
3 Replies

4. Shell Programming and Scripting

Match File and Copy File Script (Homework, Closed)

Can you please help on this? I am looking for the shell script which does following:- step 1: It should open the file /u/manish/input/FileIndex.dat and read line by line step 2: Once first line is read (for ex: File1), we have to find a file, that contains this matching... (4 Replies)
Discussion started by: teteguru1
4 Replies

5. Shell Programming and Scripting

simplify the script, check field match to value in a file

Hi Everyone, Below is the script, i feel there should be more simple way to do the same output, my one works, but feel not nice. like using index i feel it is slow (image my file is very large), maybe awk can do one line code? Please advice. # cat 1.txt 1 a 2 b 3 cc 4 d # cat 1.pl... (6 Replies)
Discussion started by: jimmy_y
6 Replies

6. Shell Programming and Scripting

awk pattern match and search in single statement

Hi All, I am trying to alter all lines between EXEC SQL and END-EXEC that have an INCLUDE in them. The following code search="INCLUDE " cp -f ${WORK}/$file.in ${WORK}/$file.wrk2 for item in `echo $search `; do > ${WORK}/$file.wrk1 awk -vITEM="$item" '{ if ( $0... (3 Replies)
Discussion started by: Bruble
3 Replies

7. Shell Programming and Scripting

trying to find match from multiple string if statement

I'm trying to create what (should be) a simple bash script that will pull computer name and use that info to bind to one of three servers. Is there any way to do this without having a text file with the names of the servers and associated computer names? (5 Replies)
Discussion started by: jacobsbigbro1
5 Replies

8. Shell Programming and Scripting

Bash Script Issues (If statement for file copying)

Writing a bash script for use with Geektool, pulls the battery info, and shuffles images around so that an Image geeklet can display the correct expression as the desktop background. (Eventually I intend to make it more intricate, based on more variables, and add more expressions) I'm extremely... (1 Reply)
Discussion started by: The_Ardly374
1 Replies

9. Shell Programming and Scripting

Script to read a log file and run 2nd script if the dates match

# cat /tmp/checkdate.log SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 17 22:49:00 2012 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production FIRST_TIME NEXT_TIME... (1 Reply)
Discussion started by: SarwalR
1 Replies

10. Shell Programming and Scripting

if then else; no variable match but statement executes anyway.

My first then statement is executing even though there is no match between the variables. each subsequent if then statement is also executing. Why do they execute when there is no match in the dates? yr=`date +%y` date1=12-31-$yr date=`date +%m-%d-%y` set -vx if ; ... (6 Replies)
Discussion started by: bash_in_my_head
6 Replies
BDB.DB0(5)							AFS File Reference							BDB.DB0(5)

NAME
       bdb.DB0, bdb.DBSYS1 - Contain the Backup Database and associated log

DESCRIPTION
       The bdb.DB0 file contains the Backup Database, which records configuration information used by the AFS Backup System along with cross-
       indexed records of the tapes created and volumes dumped using the Backup System commands.

       The bdb.DBSYS1 file is a log file in which the Backup Server (buserver process) logs each database operation before performing it. When an
       operation is interrupted, the Backup Server replays the log to complete the operation.

       Both files are in binary format and reside in the /var/lib/openafs/db directory on each database server machine that runs the Backup
       Server.	When the Backup Server starts or restarts on a given machine, it establishes a connection with its peers and verifies that its
       copy of the bdb.DB0 file matches the copy on the other database server machines. If not, the Backup Servers use AFS's distributed database
       technology, Ubik, to distribute to all of the machines the copy of the database with the highest version number.

       Use the commands in the backup suite to administer the Backup Database. It is advisable to create a backup copy of the bdb.DB0 file on tape
       on a regular basis, using the UNIX tar command or another local disk backup utility.

SEE ALSO
       backup(8), backup_savedb(8), buserver(8)

COPYRIGHT
       IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved.

       This documentation is covered by the IBM Public License Version 1.0.  It was converted from HTML to POD by software written by Chas
       Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell.

OpenAFS 							    2012-03-26								BDB.DB0(5)
All times are GMT -4. The time now is 07:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy