how to poll for new files?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to poll for new files?
# 1  
Old 09-30-2009
how to poll for new files?

Hi ,
i have a requirement in which i have to ftp files to unix from windows and vice versa.
I have to encrypt files in windows which will then be decrypted in unix and vice versa.
Now the process needs to be automated ..therefore when windows server or unix server recieves the files a shell script or a batch files should set off encrypting the file.
Could anybody help me out with this?i have heard of some polling mechanism..but have no idea
# 2  
Old 09-30-2009
You don't have to do the polling in the script, just place the script in the crontab and cron will call it at regular intervals for you. (see "man cron" for details on how to do this.)

It is possible to get a list of files sorted by timestamp ("ls -rt" or "ls -t"), therefore the only thing you have to remember between runs of the script is the last file you have processed.

I hope this helps.

bakunin
# 3  
Old 09-30-2009
Look at the tools like putty, puttygen, psftp on windows and ssh, scp, sftp on unix.

you can transfer the file from 'server a' to 'server b' and then 'server a' can remotely kick a script on 'server b' when the transfer completes. it will work in either direction. you could make one server both push and pull as well, rather than setting up redundant processes on both machines.

Obv. don't know all your requirements, but if possible, it makes more sense to encrypt before xfer, lest anyone intercept. The use of scp or sftp reduces this risk as conversation will be encrypted. Nonetheless...
# 4  
Old 09-30-2009
Script

Sry, I read the question wrong... deleted previous rubish :-)

However, I have a simuliar situation. I have a Windows batchfile that moves backup files to a certain share that is accessible via https. On my BSD box a cron runs to fetch/wget that file on a weekly base. Its quite easy.
# 5  
Old 09-30-2009
Hi necron,
How do u check for new files?
# 6  
Old 09-30-2009
I have a script on my BSD box that runs via crontab every 5 mins.
If you want I can paste the script here? It's a bash script.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. AIX

Poll of sorts - on LDAP

1) Do you use LDAP on AIX? (as a client) 2) If yes, what LDAP server technology do you use: a) IDS (or ITDS) - IBM Tivoli Directory Server b) AD c) openLDAP d) other - please list. I ask, because I am looking at openLDAP as well as IDS and am wondering if there is a clear preference I... (4 Replies)
Discussion started by: MichaelFelt
4 Replies

2. Shell Programming and Scripting

Shell Script to poll files

Hello, I need to write a script for my prod servers, here is the requirement. 1. Shell script should poll the directory everyday at 3pm for 2 files a.csv and a.dat. It should poll the directory for the files for only 15 mins after that it should error out saying that no files received.... (6 Replies)
Discussion started by: Siddheshk
6 Replies

3. Shell Programming and Scripting

Script to Poll Directory and Copy files

Hi all, I'm looking for a script to poll a specified directory and copy new files to another location. The script should only copy new files so, I based on mtime I guess? Can anyone point me in the right direction of a script which could do this? My scripting skills aren't too bad, but... (1 Reply)
Discussion started by: JayC89
1 Replies

4. Shell Programming and Scripting

How to use poll() for I/O multiplex

Hi, guys: I want to write my own shell using C. I am confused about the usage of I/O multiplex. Does anyone know some examples or explain it to me ? Thanks so much (1 Reply)
Discussion started by: tomlee
1 Replies

5. Programming

pipe() and poll() problem in C

Hi all, Im trying to do a simple program which ask the user for a unix command with the arguments. The program fork and the two process communicate with pipes. The child process call execvp with the command and the father process read the result of the execvp via the pipe. This program works... (11 Replies)
Discussion started by: blackmamba21
11 Replies

6. UNIX for Dummies Questions & Answers

Poll data from a file

I have to write a script where I poll a txt file for data (30 min interval) Dependent on the data read, the script should return a message. It should look something like the "code" below: -- do while <data recived> sleep 30m read data from file Done If <data> x return "A" If... (1 Reply)
Discussion started by: ioniCoder
1 Replies

7. IP Networking

select vs poll

Hi, Off late I had been looking at the differences b/w select() & poll() system calls. The requirement is to reduce the overhead, processor power in waiting for the data. In the kind of connections under consideration there would be very frequent data arriving on the sockets, so poll() fares... (12 Replies)
Discussion started by: smanu
12 Replies
Login or Register to Ask a Question