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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
On relationships among: derived event, composite event, complex event and situation iBot Complex Event Processing RSS News 0 07-17-2008 06:50 AM
wait command - cat it wait for not-chile process? alex_5161 Shell Programming and Scripting 2 06-26-2008 06:14 PM
Need to execute 2 scripts, wait, execute 2 more wait, till end of file halo98 Shell Programming and Scripting 1 08-01-2006 04:42 PM
How to find the File Age and wait for that... redlotus72 UNIX for Dummies Questions & Answers 3 06-01-2005 03:13 AM
Lock a file. AND Wait if file is locked sunil_neha Shell Programming and Scripting 2 07-13-2004 10:40 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-09-2009
rajesh_tns rajesh_tns is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 17
event or file wait scenario

i want to do 2 things

1) i should wait for a file called A.txt to fall on a specific path on the server
2) once the file arrives immediately another script called B.sh should be executed.

Could you please throw somelight on this.
Any code if already present that would be helpful.

Regards
Rajesh
  #2 (permalink)  
Old 02-09-2009
avronius avronius is offline VIP Member  
VIP Member
  
 

Join Date: Apr 2008
Location: Calgary
Posts: 305
How large is A.txt? It can "appear" on the host before all of the data has been written. If you "immediately" run another script, you risk affecting a change to a partial file...
  #3 (permalink)  
Old 02-09-2009
rajesh_tns rajesh_tns is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 17
hi

hi

A.txt is just an indicator /dummy file... am waiting for this file just to make sure that this is the time ... that i should run b.sh script
  #4 (permalink)  
Old 02-09-2009
methyl methyl is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1,147
One way is to sit in a sleep loop.

Code:
while true
do
        if [ -f A.txt ]
        then
                sleep 10
        else
                break
        fi
done
b.sh

avronius is right. Unless the file is a simple flag created with something like "touch" it could be not ready for processing.
  #5 (permalink)  
Old 02-09-2009
avronius avronius is offline VIP Member  
VIP Member
  
 

Join Date: Apr 2008
Location: Calgary
Posts: 305
This link might help you a bit:
scripting running every minute

Have the script check for the existence of the file that you are referring to - if it finds the file, do stuff...

- Avron
  #6 (permalink)  
Old 02-09-2009
rajesh_tns rajesh_tns is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 17
event wait throu unix

hi

thanks for your response.. i have gone through your link but i would like to explain my case once again

I have a script called B.sh
Its not scheduled to run at any specific time.

Now..

I receive a file A.dat at a specified location daily.

Once i see the file ... i should remove it and then B.sh should start

This should happen daily .
  #7 (permalink)  
Old 02-09-2009
rajesh_tns rajesh_tns is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 17
Yes the file is a touch file
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 07:34 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0