From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 17 12:16:33 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36D591065689; Fri, 17 Oct 2008 12:16:33 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from ipmail01.adl6.internode.on.net (ipmail01.adl6.internode.on.net [203.16.214.146]) by mx1.freebsd.org (Postfix) with ESMTP id 71A878FC15; Fri, 17 Oct 2008 12:16:32 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqwEAM8S9kh5LWPz/2dsb2JhbACBcsA0gWs X-IronPort-AV: E=Sophos;i="4.33,431,1220193000"; d="asc'?scan'208";a="212957678" Received: from ppp121-45-99-243.lns10.adl6.internode.on.net (HELO midget.dons.net.au) ([121.45.99.243]) by ipmail01.adl6.internode.on.net with ESMTP; 17 Oct 2008 22:31:12 +1030 Received: from inchoate.dons.net.au (Inchoate.dons.net.au [10.0.2.99]) (authenticated bits=0) by midget.dons.net.au (8.14.3/8.14.2) with ESMTP id m9HC10ar000116 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 17 Oct 2008 22:31:05 +1030 (CST) (envelope-from doconnor@gsoft.com.au) From: "Daniel O'Connor" To: freebsd-hackers@freebsd.org Date: Fri, 17 Oct 2008 22:30:52 +1030 User-Agent: KMail/1.9.9 References: <20081017094820.GA2013@doom.ctinet.ru> In-Reply-To: <20081017094820.GA2013@doom.ctinet.ru> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1851669.YiSBqXmGtp"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200810172231.05324.doconnor@gsoft.com.au> X-Spam-Score: -1.906 () BAYES_00,SPF_FAIL X-Scanned-By: MIMEDefang 2.64 on 10.0.2.7 Cc: Igor Pokrovsky , hackers@freebsd.org Subject: Re: lock test from sh script X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 12:16:33 -0000 --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--