Gentoo Archives: gentoo-user

From: Ow Mun Heng <Ow.Mun.Heng@×××.com>
To: gentoo <gentoo-user@l.g.o>
Subject: [gentoo-user] Accurate way of Detecting # of times a file is opened
Date: Tue, 03 Jan 2006 07:46:27
Message-Id: 1136273875.14540.29.camel@neuromancer.home.net
1 Hi,
2 I hope this isn't off-topic.
3
4 I have a few files which I would like to share to some housemates, but I
5 don't want these files to be opened by everyone at the same time. (limit
6 stress on my PC etc)
7
8 So, what I would like to do is some sort of library checkout mechanism.
9 I'm hoping to be able to write a script that will check how many
10 instances of the file is already in use.
11
12 My initial thinking is to use lsof.
13
14 eg: lsof | grep -i exact_filename | wc -l
15
16 and count the number of times it occurs, compare it to a database(?)
17 (this is most likely to be just a txt file) and see if I will permit the
18 connection.
19
20 Is lsof a suitable/accurate tool? I mean, based on linux's
21 architechture, one can still access/stop playing the file( but didn't
22 close the orig app that played/used it)
23
24 Comments please?
25
26 (Preferably a command line app / solution)
27
28
29 --
30 Ow Mun Heng
31 Gentoo/Linux on DELL D600 1.4Ghz 1.5GB RAM
32 98% Microsoft(tm) Free!!
33 Neuromancer 15:26:22 up 1:53, 5 users, load average: 0.78, 0.78, 0.65
34
35
36 --
37 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] Accurate way of Detecting # of times a file is opened Matthias Bethke <matthias@×××××××.de>