start job after complete transfer....


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting start job after complete transfer....
# 1  
Old 03-15-2006
start job after complete transfer....

Hi,

I have a situation... I have a script it checks for a file in a folder which comes to the folder every day at specified time...2am to 4 am, once the file is in the polder my process starts...but the problem is the files being placed are huge and it is even taking half an hour for the file to complete transfer from other side, but even before transfer is complete my script wakes up and detects file which is still in process of transfer and triggers the job and my job is failing...because it does not have the access to the file or it has write lock on it....how to overcome situation.....? Here is my script..

Code:
#! /usr/bin/sh
count=1
cd /to/path/of/file
while true
do
 if [ -f file.txt ]
  then
    start my job
    exit 0
   fi
if [ $count = 4 -o $count = $8 -o $count = 12 ]
then
 mail -s " file not recieved....."
fi
if [ $count = 16 ]
then 
mail -s "Final alert File not recieved..."
exit 1
fi
let count=count+1
done

I could think of checking of file size aswell but that adds more time on my script...is there any way of doing it easily....

Thanks,
# 2  
Old 03-15-2006
A common solution to this is to have a trigger file transmitted to the folder after the large file. Then your script checks for the trigger file before proceeding.
# 3  
Old 03-15-2006
Another method for files that have a known format where the last record of the file is a trailer record, which can also be easily be tested.
# 4  
Old 03-15-2006
Thanks a lot that helps.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Automation script for email alert when a job get complete with status successful.

Guyz, Please let me know about script which is to be sending an automatic email to particular mail id's when a monotoring job get complete with status successful. (1 Reply)
Discussion started by: Rehan Ahmad
1 Replies

2. UNIX for Advanced & Expert Users

Autosys Job: Job did not start

I have submitted an autosys job and force start it. Autosys hit the job 4 times to restart but it did not start and finally I terminate the job. Any idea why the job did not start. Below is the code I executed. 1214 missun0ap /export/home/bzn97r/develop/dswi/jil$ sendevent -E FORCE_STARTJOB... (0 Replies)
Discussion started by: jnrohit2k
0 Replies

3. Shell Programming and Scripting

I want a script to view the complete log information of data stage job from UNIX IBM AIX.

Hi, I am working on data stage 8.7 version and I want a script a to view the all log information of the data stage job from UNIX environment. Can you please help me out by give the script. Thanks in advance... (7 Replies)
Discussion started by: victory
7 Replies

4. Windows & DOS: Issues & Discussions

AutoSys Job not waiting for script to complete

I'm not sure if this is the right place to post this issue...but here goes... I am converting a set of windows jobs from Control-M to AutoSys r11.3. The same command line is being executed in both systems. The Control-M job runs to compltion in about 1.5 hours, waiting for the entire batch... (3 Replies)
Discussion started by: ajomarquez
3 Replies

5. UNIX for Dummies Questions & Answers

SFTP transfer does not complete

I am able to connect to a site and start a file transfer via SFTP, but when the file reaches "100%" -- the file does not complete and "stop". The 100% transfer status does not change (obviously), but the timer for SFTP keeps going and will not complete. This also happens when I try to get a file.... (2 Replies)
Discussion started by: loganban
2 Replies

6. Shell Programming and Scripting

Scripting job to complete

Hi Friends, I don't have much experience in shell scripting & have a urgent scripting job to complete. Need your help to do the following. I have a input file like below: CDR #1 ---------- Name James Age 30 Country Japan CDR #2 ---------- Name Robin Age 31 Country Germany ... (18 Replies)
Discussion started by: SunilB2011
18 Replies

7. Shell Programming and Scripting

Script to Start a Job after finding the Old job completed

Hi Experts, I need a script advice to schedule 12 jobs ( SAS Codes execute back ground ). Algorithem: 1. Script checks first job. 2. Finds first job is done; invoke second job. 3. finds second job is done; invoke third job. .. Request you to please assist. (3 Replies)
Discussion started by: Jerald Nathan
3 Replies

8. Shell Programming and Scripting

grep "226 Transfer complete" | wc -l

echo $ftp_ctr returns '0' instead of '1'. Please help 331 Enter password 230 User logged in 200 Transfer mode set to BINARY local: file1 remote: file2 227 Entering Passive Mode (xxxxxxxx). 125 Uploading in BINARY file xxx 226 Transfer completed 24453780 bytes sent in 67 seconds... (9 Replies)
Discussion started by: Lenora2009
9 Replies

9. UNIX for Advanced & Expert Users

Complete dump from start to the end

Hi all... I was accidentally wipe off my iphone and lost all the data in it:(. So I tried to use dd to create an image from iphone and ssh to the Mac by using: dd if=/dev/disk | ssh user@MacIP of='image.img' Then I mount this image on Mac/Windows and run recovery software because most of the... (1 Reply)
Discussion started by: seraphc
1 Replies

10. Shell Programming and Scripting

File Processing after complete transfer

Hello everybody I have wriiten a script that, processes a file, only after its found in a particular folder, the files come in via ftp, everyday at different times, morning, afternoon and evening. The script is run every 5 minutes(0,5,10,15,20...55 minutes) of every hour. The problem i am... (8 Replies)
Discussion started by: karimone
8 Replies
Login or Register to Ask a Question