Contantly check for file at the remote server and ftp when avaliable


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Contantly check for file at the remote server and ftp when avaliable
# 1  
Old 12-17-2008
Contantly check for file at the remote server and ftp when avaliable

Hello,
I used the search engine but could not find the solution I am looking for. Probably its simple but I do not know the solution.
My requirement is I ftp files every day in the morning from the remote server to the local machine. Now if the files are not there at the time I schedule the ftp process, my script will exit saying file not found.

Now I do not want to exit the script and constantly check the ftp server and start the ftp process as soon as the file is avaliable. I tried sleep for 1000 seconds but do not know if thats the only option. Are there any commands that can detect a new file in the remote location and trigger the ftp mechanism?

Please let me know If I am not clear. I would really appreciate your help.
# 2  
Old 12-18-2008
You may try following method.

Schedule a cron job in your local machine which will check whether file is copied already for the day. If not, it has to connect to the remote machine and try to copy it.

Here the problem is even after copying file to local machine, cron job will run. You may alter the cronjob set up inside your script to fire only on the next day on successful copy.
# 3  
Old 12-19-2008
Could you please send me a sample script. I know I am asking for too much but my expertise is very limited in UNIX scripting.

Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File Check in remote server

Hi Experts, I need a script in which I need to scp a file /home/chandan/abc.txt to a remote server using scp. Then I need to check whether scp is successful or not. How am I going to write this code? My Server Name: myserver File Name On My Server: /home/chandan/abc.txt Destination Server... (3 Replies)
Discussion started by: ChandanN
3 Replies

2. Shell Programming and Scripting

Urgent: File Check in remote server

Hi Experts, I need a script in which I need to scp a file /home/chandan/abc.txt to a remote server using scp. Then I need to check whether scp is successful or not. How am I going to write this code? My Server Name: myserver File Name On My Server: /home/chandan/abc.txt Destination Server... (1 Reply)
Discussion started by: ChandanN
1 Replies

3. Shell Programming and Scripting

FTP a File to a Remote Server

Hi, I'm fairly new to Linux and need help with a script to ftp a .csv file to a remote server. I can ftp the .csv file manually from my server to the remote server in the "/" location. When I execute the script I receive the following message Could not create file. Here's what I have for... (5 Replies)
Discussion started by: Computergal2104
5 Replies

4. Shell Programming and Scripting

ssh to remote server and check if file exists

Hi everyone, I am trying to figure out a way to ssh to remote server and check if file exists, and if it doesn't I want to leave the script with an exit status of 5. I have the following that I am attempting to use, but it is not returning anything: check() { ssh ${SOURCE_SERV} "ls -l... (4 Replies)
Discussion started by: jimbojames
4 Replies

5. UNIX for Dummies Questions & Answers

ftp - check if file on remote exists (skip overriding)

Hello, I have a script that uploads a file from local to remote place using ftp. The problem is that, if on remote host there is a file called the same as the one I want to upload, the ftp program overrides that file. But I don't want to override nothing (even if the remote file is older,... (3 Replies)
Discussion started by: spiriad
3 Replies

6. Shell Programming and Scripting

preserving the timestamp of a file when copied from remote server to local server using ftp

Hi, I need to copy few files from remote server to local server. I write a shell script to connect to the remote server using ftp and go to that path. Now i need to copy those files in the remote directory to my local server with the timestamp of all those files shouldnt be changed. ... (5 Replies)
Discussion started by: arunkumarmc
5 Replies

7. Shell Programming and Scripting

How to check whether file is exist on remote server

Hi all, I am new to UNIX Scripting. I would like to know how to check whether file is exist in remote server. I have google, but cannot find any solution that works. Currently my code is like this: if ; then echo 'data file exist' else echo 'data file not exist' fi Thanks in... (3 Replies)
Discussion started by: suigion
3 Replies

8. UNIX for Dummies Questions & Answers

To ftp file on a remote server

I want to send some files in .gz format from my desktop to a remote server. What will be the procedure for that thanks (5 Replies)
Discussion started by: supercops
5 Replies

9. Shell Programming and Scripting

How to check the file status in a remote server?

Hi All, Thanks in Advance. My requirement is there are some data files to be updated(some times new files get created) regularly in server A, these files are to be updated to the server B(backup server) by using SCP, I have to write a script for this purpose, before copying the files to server... (3 Replies)
Discussion started by: rajus19
3 Replies

10. Shell Programming and Scripting

FTP a file to a remote Server

Dear all, I am trying to push a data file to a remote Server. I am taking date variable from the database. The file I want to push looks like this in /tmp hostname.export.beforedate.dmp.gz for reading the date from the database i have a file get_date.sql which contains select... (2 Replies)
Discussion started by: shivaraj
2 Replies
Login or Register to Ask a Question