Poll data from a file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Poll data from a file
# 1  
Old 04-19-2009
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 <data> y return "B"
--
How do I write a a script solving this issue?
# 2  
Old 04-19-2009
Hello,

I believe that following are the issues in concern:
1. causing the process to wait/sleep for 30min
2. reading from the file
3. comparing the data received
4. showing the apt o/p

Since u need this process to run intermittently, atleast as it seems, I advise u to put it in a cron job.
If, u wish to use an infinite loop only or cannot use the cron for some reason, u must do this:
for 1 : sleep <number of secs> Eg:
Code:
sleep 1

causes a wait of 1 second
for 2,3,4: i dont think they should be a problem. If u have a prob in any of these please tell.

Regards,
HKansal
 
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. What is on Your Mind?

Powerhouses and mainstream poll

This not a joke but a quite serious question to maybe have your point of view about this very topic of content on the net. So I start this poll to ask the users if they can imagine that the so called content industry of former times sooner or later or anyway will regain lost ground or not? Do you... (1 Reply)
Discussion started by: 1in10
1 Replies

2. UNIX for Dummies Questions & Answers

Mapping a data in a file and delete line in source file if data does not exist.

Hi Guys, Please help me with my problem here: I have a source file: 1212 23232 343434 ASAS1 4 3212 23232 343434 ASAS2 4 3234 23232 343434 QWQW1 4 1134 23232 343434 QWQW2 4 3212 23232 343434 QWQW3 4 and a mapping... (4 Replies)
Discussion started by: kokoro
4 Replies

3. 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

4. Shell Programming and Scripting

Poll for a file. If not present...Send a alert mail

Dear Experts, I have a requirement where a 3rd party system places a file in my folder.I am running on HP UNIX. I would like to have a unix script which will check for the existence of the file. If yes OK. if the file is not placed then it has to send a mail to couple of emails ids saying that... (3 Replies)
Discussion started by: phani333
3 Replies

5. Shell Programming and Scripting

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... (5 Replies)
Discussion started by: lifzgud
5 Replies

6. UNIX for Dummies Questions & Answers

SFTP script - poll every min to check file complete before transfering

Hello, Before I do a GET remote file, I need to ensure the remote file is a complete file i.e. whatever process is saving the file to the remote folder should complete the transfer before I go GET it through my script. So I'm thinking I need to poll the remote file every minute or so to... (4 Replies)
Discussion started by: srineel
4 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