The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 11-22-2007
grial's Avatar
grial grial is offline Forum Advisor  
El UNIX es como un toro
  
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
There are several approaches depending on:
- the backup script runs outside your script.
- the backup script finishes when that line is shown inside the log.
- the backup log only has (or will have) one line containing the text.
- others...
One possibility in this case:
Code:
#!/bin/ksh

( tail -f backup.log | while read l; do
   echo ".\c"
   echo $l | grep "the requested operation was successfully completed" > /dev/null 2>&1
   (( ! $? )) && exit 0
done ) && echo "string found, continue..."

# whatever to execute after the match, down here...
At least if you want to check the log file "on the fly"...

Regards.

Last edited by grial; 11-22-2007 at 12:21 PM.. Reason: comment added