Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Oct 2008 22:30:52 +1030
From:      "Daniel O'Connor" <doconnor@gsoft.com.au>
To:        freebsd-hackers@freebsd.org
Cc:        Igor Pokrovsky <ip@doom.ctinet.ru>, hackers@freebsd.org
Subject:   Re: lock test from sh script
Message-ID:  <200810172231.05324.doconnor@gsoft.com.au>
In-Reply-To: <20081017094820.GA2013@doom.ctinet.ru>
References:  <20081017094820.GA2013@doom.ctinet.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart1851669.YiSBqXmGtp
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Friday 17 October 2008 20:18:20 Igor Pokrovsky wrote:
> I need to check if file is locked or not (with flock) from a shell
> script. I remember there was something but cannot recall what exactly.
> And if possible I do not want to write my own test utility even it
> is several lines in length)

lockf -s -t 0 /path/to/file /bin/echo -n
if [ $? -eq 75 ]; then
	echo file is locked
	exit
fi

=2D-=20
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C

--nextPart1851669.YiSBqXmGtp
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQBI+H6B5ZPcIHs/zowRAplmAJ4wFmcoTD+EY8tvcaOW+xlAghlO8QCeOrKQ
T71e4q3JQ/vcsvlFo/mcXaU=
=HxGK
-----END PGP SIGNATURE-----

--nextPart1851669.YiSBqXmGtp--



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