Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Sep 2006 13:06:37 +0200 (CEST)
From:      Oliver Fromme <olli@lurza.secnetix.de>
To:        uberlord@gentoo.org, ssedov@mbsd.msk.ru, freebsd-hackers@freebsd.org, freebsd-standards@freebsd.org
Subject:   Re: FreeBSD Port: sysutils/fuser
Message-ID:  <200609121106.k8CB6bwD088486@lurza.secnetix.de>
In-Reply-To: <200609112129.40199.uberlord@gentoo.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Roy Marples wrote:
 > Stanislav Sedov wrote:
 > > But they wants the value 0 to be returned in case of no errors, and
 > > since there are no errors in case of no files opened on mountpoint,
 > > returning non-zero could break some apps that relies on POSIX
 > > functionality.
 > > 
 > > IIRC, solaris resembles the same behavior.
 > 
 > OK, you win - I'll parse the output :)

There's no need to parse it.  If you only want to know if
_any_ process is accessing a file at all, it's sufficient
to check if stdout from fuser is non-empty.  In shell-
script syntax:

        if [ -n "`fuser -f whatever 2>/dev/null`" ]; then
                echo "File is being accessed."
        fi

Best regards
   Oliver

-- 
Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"anyone new to programming should be kept as far from C++ as
possible;  actually showing the stuff should be considered a
criminal offence" -- Jacek Generowicz



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200609121106.k8CB6bwD088486>