(Courriels de diversion: <feuler@cotiserons-sticks.com> <restreindriez@motard-regagnes.com> <legale@nervosite-mauvais.com> <virtuelles@atout-transcriras.com> <fustigeraient@gâcha-regularisez.com> <taquineras@extirperions-framboisiers.com> <paleographie@ponctualite-amusements.com> <traînent@enfermeraient-retablirez.com> <ovarienne@noircissais-denicherais.com> <grossirent@signeraient-gratterons.com> )


Georges Favre a écrit :

Le Vendredi 19 Août 2005 20:56, Jean-Baptiste Lièvremont a écrit :


PeterPan31 a écrit :






Comment faire pour savoir si un fichier est ouvert ou pas...






J'utiliserais lsof personnellement.

--
mith/J.B




A titre indicatif chez moi lsof donne :
3297 lignes sous root et 2824 lignes sous mon compte ordinaire


il serait judicieux de le piper vers une instruction permettant au minimum d'encadrer le nom du fichier cherché.

A+

--
Georges Favre



--------------------------------------------------------------------
Les listes de diffusion occultes: <URL:http://www.CULTe.org/listes/>



Heureusement lsof est pourvu de plein d'options permettant d'affiner - et ce même très finement - la recherche:

man lsof:

SYNOPSIS
lsof [ -?abChlnNOPRstUvVX ] [ -A A ] [ -c c ] [ +c c ] [ +|-d d ] [
+|-D D ] [ +|-f [cfgGn] ] [ -F [f] ] [ -g [s] ] [ -i [i] ] [ -k k ] [
+|-L [l] ] [ +|-m m ] [ +|-M ] [ -o [o] ] [ -p s ] [ +|-r [t] ] [ -S
[t] ] [ -T [t] ] [ -u s ] [ +|-w ] [ -x [fl] ] [ -z [z] ] [ -- ]
[names]


+d s This option causes lsof to search for all open instances of
directory s and the files and directories it contains at its
top level. This option does NOT descend the directory tree,
rooted at s. The +D D option may be used to request a
full-descent directory tree search, rooted at directory D.


Processing of the +d option does not follow symbolic links
within s unless the -x or -x l option is also specified. Nor
does it search for open files on file system mount points on
subdirectories of s unless the -x or -x f option is also
specified.


Note: the authority of the user of this option limits it to
searching for files that the user has permission to examine
with the system stat(2) function.
[snip]
-u s This option selects the listing of files for the user whose
login names or user ID numbers are in the comma-separated set
s - e.g., ``abe'', or ``548,root''. (There should be no
spaces in the set.)


Multiple login names or user ID numbers are joined in a single
ORed set before participating in AND option selection.


If a login name or user ID is preceded by a `^', it becomes a
negation - i.e., files of processes owned by the login name or
user ID will never be listed. A negated login name or user ID
selection is neither ANDed nor ORed with other selections; it
is applied before all other selections and absolutely excludes
the listing of the files of the process. For example, to
direct lsof to exclude the listing of files belonging to root
processes, specify ``-u^root'' or ``-u^0''.
[snip]
names These are path names of specific files to list. Symbolic
links are resolved before use. The first name may be
separated from the preceding options with the ``--'' option.



Si avec ça c'est pas possible de vérifier au fichier près je ne sais pas ce qu'il faut :)


--
mith/J.B

--------------------------------------------------------------------
Les listes de diffusion occultes: <URL:http://www.CULTe.org/listes/>