Sponsored Content
Top Forums Shell Programming and Scripting Can we run tail -f for a specified time? Post 302557635 by pat_pramod on Wednesday 21st of September 2011 06:32:46 PM
Old 09-21-2011
Can we run tail -f for a specified time?

Hi all,

I want to check a log file that gets updated very frequently, almost every second. What I want to do from a script is to check this log file
1) for a particular string
2) for a specified time
while it is getting updated. And as soon as it finds that particular string the command should stop.
I got the information from this forum which will satisfy the need 1)
but now I am looking how can a specify time for which the log file should be checked.

Originally Posted by Annihilannic
Try:
Code:
Code:
tail -f $VAULogFile | awk '/Phase/;/Phase 2 ended/ { exit }'

No need for a kill, the tail should terminate automatically when the pipe is closed.

Above is the code I used to check the log file for a particular string and exit when it is found. But now I want to specify time for which the log file should be checked and if the string is not found in the specified time then tail stop. Is it possible?

Thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Run script at same time

Hi My five script run throgh crontab at same time at 6 clock. Due to problem in the data load .Now I want to check time of load finish run these jobs. I create a script which check the load finish time but I have no idea how I run these JObs. This is very urget to me. Please reply me as soon... (3 Replies)
Discussion started by: Jamil Qadir
3 Replies

2. Shell Programming and Scripting

Run several commands at a time

Hello guys, I am new at shell scripting and I want to create a script that runs several commands at a time, ie: uptime, w, df -h and so on and send the output of this commands to a text file so it can be send via email at a certain time using crontab. Any help will be much appreciated! (4 Replies)
Discussion started by: agasamapetilon
4 Replies

3. Shell Programming and Scripting

last run time of any script

how to find when last time a scrit has ran? (7 Replies)
Discussion started by: RahulJoshi
7 Replies

4. Shell Programming and Scripting

Show date/time with tail|grep command

Hi, I have a log file without date/time, and I want that everytime tail|grep find something it displays the date/time and the line. I have tried something like this command but without any luck to display the date/time: tail -F catalina.out | sed "s/^/`date `/" | egrep ... (6 Replies)
Discussion started by: julugu
6 Replies

5. Programming

Run time Debugging

We have recently downloaded, installed and compiled gcc-3.0.4 code. gcc compiler has built successfully and we where able to compile some same test cpp file. I would like to know how we can modify gcc source code so that we add additional run time debugging statements like the binary in execution... (4 Replies)
Discussion started by: uunniixx
4 Replies

6. Shell Programming and Scripting

How to tail -f real time file.

How to tail -f real time file. I want to tail file created last time. The server is gen new file Always. . An example file. -rw-r--r-- 1 shinnie tiituck 251M Oct 18 05:39 20111018_00.log -rw-r--r-- 1 shinnie tiituck 251M Oct 18 11:18 20111018_01.log -rw-r--r-- 1 shinnie tiituck... (3 Replies)
Discussion started by: ooilinlove
3 Replies

7. Shell Programming and Scripting

how to run tail -f for 3 log files from a script

hi i need to run from a bash script tail -f /var/log/access_log >> access1 tail -f /var/log/prod/prod1 >> access1 tail -f /var/log/prod/prod2 >> access1 this script purpose is to start at server boot time and should always run. what is the best way to put it on a script Thanks Dan (1 Reply)
Discussion started by: dan12341234
1 Replies

8. Shell Programming and Scripting

How to tail real time file Generated every hour?

Hi Guys, I am developing a script to monitor log file Generated every hour. When creating a new file scripts not working. My Code . I want to monitor GatewayTransaction.yyyymmdd-hh.log while true; do newdate=$(date '+%Y%m%d') ; nowdate=$(date '+%Y%m%d-%H.log'); tail -f... (7 Replies)
Discussion started by: ooilinlove
7 Replies

9. Shell Programming and Scripting

Joining multiple files tail on tail

I have 250 files that have 16 columns each - all numbered as follows stat.1000, stat.1001, stat.1002, stat.1003....stat.1250. I would like to join all 250 of them together tail by tail as follows. For example stat.1000 a b c d e f stat.1001 g h i j k l So that my output... (2 Replies)
Discussion started by: kayak
2 Replies

10. Shell Programming and Scripting

How do i use tail & grep in real time here??

Hi I have a file which is updated very frequently. Where in i wanted to use tail -f command in the script and wanted to grep for a particular word. But the issue is when i use tail -f filename|grep "word" ... it will show me blank until the word is found in the real time. if it shows... (13 Replies)
Discussion started by: nikhil jain
13 Replies
RCSFREEZE(1L)															     RCSFREEZE(1L)

NAME
rcsfreeze - freeze a configuration of sources checked in under RCS SYNOPSIS
rcsfreeze [symbolic revision name] DESCRIPTION
The rcsfreeze command has the purpose of assigning a symbolic revision number to a set of RCS files, which form a valid configuration. The idea is to run rcsfreeze each time a new version is checked in. A unique symbolic revision number (C_number, where number is increased each time rcsfreeze is run) is then assigned to the most recent revision of each RCS file of the main trunk. If the command is invoked with an argument, then this argument is used as the symbolic name to freeze a configuration. The unique identi- fier is still generated and is listed in the log file but it will not appear as part of the symbolic revision name in the actual RCS files. A log message is requested from the user which is saved for future references. The shell script works only on all RCS files at one time. It is important that all changed files are checked in (there are no precautions against any error in this respect). Run rcsclean(1L) first and see whether any sources remain in the current directory. FILES
[RCS/]rcsfreeze.version for the version number [RCS/]rscfreeze.log for the log messages, most recent log message first. AUTHOR
Stephan v. Bechtolsheim SEE ALSO
rcs(1L), rlog(1L), rcsclean(1L) BUGS
The program does not check whether there are any sources checked out and modified. Purdue University RCSFREEZE(1L)
All times are GMT -4. The time now is 03:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy