FreeBSD Port: sysutils/fuser

Oliver Fromme olli at lurza.secnetix.de
Tue Sep 12 04:06:48 PDT 2006


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


More information about the freebsd-standards mailing list