473,230 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,230 software developers and data experts.

2 daemons write to a single file /w python file IO


i have a newbie question about the file() function.
I have 2 daemons running on my linux box.

1 will record the IDs to a file - logs.txt
other 1 will open this file, read the IDs, and then "Clean up the
file" -logs.txt

Since these 2 daemons will run every 2-5mins, I think this will crash, isn't
it? When both daemons try to write to the file at the same time.

I am wondering if this won't crash, OR if there is some simple high-level
functions can lock the file while writing...
I also wonder if one side locked the file, what happens if the other side
try to open this locked file? raise error? so i also need to write a loop to
wait for the file to release locking?

seems a basic easy thing but i just cannot find an simple answer.
I always advoid this issue by putting them in mysql (well, fast and hassle
free for locking)


Sep 12 '07 #1
0 914

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: gnewsg | last post by:
Hi all. I've just finished to write an FTP daemon in Python. To do things well I'd like to write an 'insteller' to permit the end user to 'deeply' install the package inside the system. In details...
by: PurpleServerMonkey | last post by:
Seeking feedback from group members on a design I'm looking at using in a project. I've created an XML-RPC server and a number of Daemons, the idea is that the XML-RPC server gets a request from...
by: Jeffrey Barish | last post by:
As per Stevens/Rago, "file and record locking provides a convenient mutual-exclusion mechanism". They note the convention of putting the lock file in /var/run in a file called <name>.pid, where...
by: Cameron Simpson | last post by:
On 12Nov2008 14:07, Jeff McNeil <jeff@jmcneil.netwrote: | On Nov 12, 4:57 pm, Jeffrey Barish <jeff_bar...@earthlink.netwrote: | As per Stevens/Rago, "file and record locking provides a convenient...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.