Gentoo Archives: gentoo-user

From: Matthias Bethke <matthias@×××××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Accurate way of Detecting # of times a file is opened
Date: Tue, 03 Jan 2006 18:04:18
Message-Id: 20060103175630.GA11421@huxley
In Reply to: [gentoo-user] Accurate way of Detecting # of times a file is opened by Ow Mun Heng
1 Hi Ow,
2 on Tuesday, 2006-01-03 at 15:37:55, you wrote:
3 > I have a few files which I would like to share to some housemates, but I
4 > don't want these files to be opened by everyone at the same time. (limit
5 > stress on my PC etc)
6 >
7 > So, what I would like to do is some sort of library checkout mechanism.
8 > I'm hoping to be able to write a script that will check how many
9 > instances of the file is already in use.
10
11 Depends on what protocol you want these files shared over. I don't think
12 there's any way short of hacking the source to implement this with NFS
13 of Samba. If you use HTTP, it should be fairly easy to write a little
14 CGI script that keeps a counter of downloaders for each file in some
15 kind of lock-file.
16 However, I doubt you need this anyway. Due to the way Linux's buffer
17 cache works it's actually likely to cause less stress on your HD when
18 everybody is reading the same file than when the same number of readers
19 each read a different file. Of course it may make sense to limit the
20 total number of readers with something like Samba's "max connections".
21
22 regards
23 Matthias
24 --
25 I prefer encrypted and signed messages. KeyID: FAC37665
26 Fingerprint: 8C16 3F0A A6FC DF0D 19B0 8DEF 48D9 1700 FAC3 7665