Polling continously for presence of a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Polling continously for presence of a file
# 1  
Old 06-23-2009
Polling continously for presence of a file

Hi,
My os is sun solaris 5.10 and Korn shell scripting.

I have a file name like CCNA_EARLY_SWP.w062309
where 062309 is date in mmddyy .This is the value date of the file.(will
I need to check continously from 5.00 - 7.00 am daily for this file .
If the file has not come at 5 am or 7am ,I need tor aise alert message.
If the file has not come at 7am , i need to exit from script with error return code.
Apart from this, I do not want to poll continously , if the time is not between 5.00 and 7.00 am , but only check for presence of file,if present do next step otherwise exit with error code.

Can anyone give some good example to proceed
# 2  
Old 06-23-2009
man cron
# 3  
Old 06-23-2009
you need to setup a cron job, to know more, read here
# 4  
Old 06-23-2009
I'm using ETL to call unix script.
How can I achieve the requirement in unix script itself
# 5  
Old 06-23-2009
before checking for file get the time stamp if it is not in your range --sleep for some time and then wake up
If your bail out time reach and still the file not present --Sent a mail and Exit from the script

You can consider using scheduler -like Autosys which is equiped with file watcher functionality
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Polling file

HI I need some help on this below one Have summuary file coming on daily basis with list of file names and count ,if the summuary file not exist ,pool it for every 5 mins till it arrives .Once arrived remove first and last line from the file and check all the files in respective director all... (12 Replies)
Discussion started by: mohan705
12 Replies

2. Shell Programming and Scripting

Check presence of trigger file

Hi, I make a sftp connection successfully.My requirement is the script shall execute only after i find a trigger file(dailyreport.OK.psv) in the remote dir. If the trigger file is not present ,the script should exit else it should continue with the rest of the scripts statements. Below code is... (13 Replies)
Discussion started by: samrat dutta
13 Replies

3. Shell Programming and Scripting

Identifying presence and name of new file(s)?

I have an HP-UX server that runs a script each night. The script connects to an SFTP server and downloads all xml files (if any are present) from a certain folder, and then deletes the files from the SFTP server. So sometimes it will download a new file, sometimes it will download 2 or 3 new... (4 Replies)
Discussion started by: lupin..the..3rd
4 Replies

4. Shell Programming and Scripting

Check the presence of file >size?

Hi, Following script work fine: #!/bin/bash FILE=$1 if ; then echo Yay else echo Boo fi But I would like to add another condition that if FILE... (3 Replies)
Discussion started by: nrjrasaxena
3 Replies

5. Shell Programming and Scripting

Redirecting stdout continously to a file

I have a C program that continously outputs info to stdout. The problem is that I am redirecting the stdout and stderr to a file and stdout is written at the end of the problem rather than continously to the file. This could be a problem if for example the program is killed and the stdout output is... (3 Replies)
Discussion started by: igurov
3 Replies

6. Shell Programming and Scripting

Polling for existence of file on remote host

I am polling a file on remote host. I have this code that works, but can't explain why it works. while user@remote.no-exist.com 'ls /user/app1/.done'` ] do echo Sleeping for 5 secs sleep 5; done This code works in the way that when the .done file exists on the remote host, the script... (1 Reply)
Discussion started by: starlatch
1 Replies

7. Shell Programming and Scripting

check file for presence of set of strings

hi everybody, I need a quick help with this issue. I have configuration file in which the following set of strings must be present. I need to check it with the bash script (leading spaces are not significant). Check must be case insensitive. Can anybody help? ... any lines <SECTION... (4 Replies)
Discussion started by: sameucho
4 Replies

8. UNIX for Dummies Questions & Answers

Delete lines from a file where data is continously appended

Hello , Is there a way to delete lines from a file where data is continously appended to the file. I can use normal vi command ndd to remove n number of lines from the file, as the data is continously appended the line numbers doesnt work. (1 Reply)
Discussion started by: sophos
1 Replies

9. Shell Programming and Scripting

check presence of input file

My script is taking a file "input.in" as input for running the script. My worry is that i need to execute the script only if the file is present, if it's not don't perform the next commands. Just to have a check at the beginning of the script : If "input.in" exists, then go on. If it's does not... (4 Replies)
Discussion started by: newpromo
4 Replies

10. UNIX for Advanced & Expert Users

Polling an FTP site for a file

Hi, I'm after a bit of advice for the best way to collect files from an ftp server via a unix process. The main issue here is the frequency, the job needs to check for files every minute or so between 8am and 8pm and pull them down to the box if there is anything there. Originally the... (6 Replies)
Discussion started by: Peejay
6 Replies
Login or Register to Ask a Question