prevent multiple tail in back ground


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting prevent multiple tail in back ground
# 1  
Old 04-23-2012
prevent multiple tail in back ground

Dears

i have a scrip run in unix that need to use the tail -f command, as below:

Code:
DATE=`date '+%m%d%y'`
tail -f /var/messages |  grep "start" >> /export/logs/start_${DATE}.out

but the problem that the tail -f will be stop and working in the background in then end of the day (23:59:59) that mean the time (start_${DATE}.out) is finished. and the time that the messages files are rotated (2:59:59)... so in the crontab i make it it run twice, one at 00:00 and second is 3:30 . at that case i will have many old tail -f processes run in the background and i need to kill them manually... so is there any way to make the tail -f keep running even a new file is created with new date and even the file messages are rotated?

thanks alot for your support really appreciated

Moderator's Comments:
Mod Comment Link: How to use [code] tags

Last edited by Scrutinizer; 04-23-2012 at 05:58 AM.. Reason: code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

how to run a script in back ground within a script

Hi friends, i have two scripts(call it bg1.ksh and bg2.ksh) which needs to be run parallely on background from a script(call it test1.ksh).then i have to wait till these two back ground job gets finished. and once it is completed , then i have to trigger one more script(call it... (4 Replies)
Discussion started by: neelmani
4 Replies

3. Shell Programming and Scripting

tail -f in Case not getting back to select choice

Hi all, Im trying to do multiple things in one script.. firstly ...i am trying to call another script in one script... secondly i am redirecting the output of second script in one file. thirdly i am also using tail -f after the calling of 2nd script. fourthly, all this is implemented in case... (6 Replies)
Discussion started by: Kartik.sh
6 Replies

4. Shell Programming and Scripting

Doing a tail in a script and then return back and continue script

Hello all, I am trying to do a tail in a script. But when I quit the tail my script quits also. This is not what I want. I am struggling to get this done. #!/bin/bash askFile() { echo -n "Enter file: " read FILE } doTail() { tail -F "${1}" } askFile doTail... (4 Replies)
Discussion started by: markdark
4 Replies

5. AIX

Help with back ground scripts...

I have a user that runs a menu driven application, is there a way to see what scripts this application is executing in the back ground? OS=AIX 4.3 (1 Reply)
Discussion started by: mangolinux
1 Replies

6. Shell Programming and Scripting

Run script in back ground

I have a script "a" running in background. From script "a" i will kick off script "b" which will also be in background. Is this possible. And actually what i want is, In script "b" when i do ps -ef, script "a" should not be seen. Current "a" script ---- --- ---- nohup b exit current... (1 Reply)
Discussion started by: vasuarjula
1 Replies

7. UNIX for Dummies Questions & Answers

Executing scripts in back ground

Hi, Test1.ksh #! /bin/ksh for i in $* do #echo "$i" ksh test2.ksh $i & done test2.ksh #! /bin/ksh sleep 5s echo "From Test 1 ==> $1" exit 0; I am executing as follows: ksh test1.ksh a b c (10 Replies)
Discussion started by: risshanth
10 Replies

8. Shell Programming and Scripting

how to prevent multiple email notifications from monitoring script

Hi everyone, I am in the process of trying to decide the correct way to solve a particular scripting/email issue I have and would appreciate any advice. We have a cronjob running every 10 mins to check disk size on the server and if this exceeds a certain percentage then it will email a... (2 Replies)
Discussion started by: si_linux
2 Replies
Login or Register to Ask a Question