How to lock an inbox using UNIX scripting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to lock an inbox using UNIX scripting
# 1  
Old 05-22-2009
Java How to lock an inbox using UNIX scripting

Hi All,

I have an inbox , which recieves mails every second. I need to copy the contents of the mails in the inbox to a file , say once every minute. Then clear the content of the inbox. There is a possibility that a new mail might come in before I delete the content.

Please let me know if there is a way to lock the inbox , so that no new mails come in , and they are queued up , till the time the lock is released.In that time gap I will copy and clear the contents of the inbox without loosing any mails.

This is bit urgent , so please help me in this. Also I not well versed in UNIX scripting.
# 2  
Old 05-22-2009
What happens if you just move the inbox to a new filename before processing it? Does your mail program re-create it or does it have the inbox permanently open (i.e. referencing it by inode)? What is your mail delivery program, sendmail or something else?

I would also try setting the mail user alias to point to a script instead of a file (you can do this in sendmail). Then the script can decide what to do with each email, and put it in different files depending on the time of day...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Ubuntu

How to lock a file through UNIX KSH shell script?

I wrote two shell scripts in UNIX that renames the same file and scheduled them at the same time. The following are the steps that I followed:- 1. I wrote 2 scripts named s1.sh and s2.sh, both trying to add “exec_” prefix to the name of the files present in a folder i which already don't start... (4 Replies)
Discussion started by: piuli
4 Replies

2. Shell Programming and Scripting

How to lock Oracle table through UNIX?

Hi frndz, Can anyone provide me some input or pseudo code for my req as mentioned below... I am loading 2 files through unix script into oracle table...as i am doing some updates also i am getting an error where both files try to update the table simultaneously and my script fails.. so i... (3 Replies)
Discussion started by: gnnsprapa
3 Replies

3. UNIX for Advanced & Expert Users

Testing privileges -lock lockfile /var/lock/subsys/..- Permission denied

Hi all, I have to test some user priviliges. The goal is to be sure that an unauthorized user can't restart some modules (ssh, mysql etc...). I'm trying to automate it with a shell script but in same cases I got the syslog broadcast message. Is there any way to simply get a return code... (3 Replies)
Discussion started by: Dedalus
3 Replies

4. Red Hat

Security Question: Lock after invalid login, Session Lock and Required Minimum Password Length

Hello all, If anyone has time, I have a few questions: How do I do the following in Linux. We are using Red Hat and Oracle Enterprise Linux, which is based on Red Hat too. 1. How to lock the account after a few (like 3) invalid password attempts? 2. How do you lock a screen after 30... (1 Reply)
Discussion started by: nstarz
1 Replies

5. Shell Programming and Scripting

Sheel Scripting to lock 2 TCP unused ports in solaris and linux

My requirement is I need to write a program in shell scripting to check 2 TCP unused unique port numbers in SOLARIS and I have to lock the same ports so that it will not be used in any other new process and the same port numbers should be used and locked in the LINUX machine to communicate... (2 Replies)
Discussion started by: sreeramr30
2 Replies

6. Shell Programming and Scripting

Applying lock on a file in Unix Ksh

Hi, How can we apply lock on a text file through Unix Ksh script. I did found a command flock (file descriptor) but am not very acquainted with the usage. Can anybody tell me if I need to use Flock command for applying locks to a file while writing on it. If the person can explain the usage... (3 Replies)
Discussion started by: kum5256
3 Replies

7. Shell Programming and Scripting

Folder Lock in Unix

I am a new user of linux. I have 2 Queries 1) I recently started working with shell script, and now i plan to make a folder lock using a shell script. I have ubuntu 8.04 installed on my system. 2) When i searched on this forum all i got was mini-httpd, and apache2-utils package, but they... (2 Replies)
Discussion started by: tsunami
2 Replies

8. UNIX for Dummies Questions & Answers

deleting a mail from inbox in unix

I want to programatically delete a mail from my inbox(preferrably through perl). Is there any unix command for the same or do we have some perl modules which can do this job. (3 Replies)
Discussion started by: xsriniva
3 Replies

9. UNIX for Dummies Questions & Answers

how to lock keyboard without using lock command

how can I lock my keyboard while I'm away from the computer without using lock command. What other commands gives me the option to lock keyboard device? thanks (7 Replies)
Discussion started by: dianayun
7 Replies

10. UNIX for Dummies Questions & Answers

How to lock a file in unix?

We wish to keep a sequence number in a file. When someone wants to get the next sequence number we need to lock the file, get the next number and increment it by one. How do you do that? I know how to get the number and increment it but how do I lock the file and test that it is locked or not... (1 Reply)
Discussion started by: tammy_schmuki
1 Replies
Login or Register to Ask a Question