From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tremer To: network@lists.ipfire.org Subject: Re: [PATCH 1/7] util: add lock/unlock function Date: Tue, 20 Jun 2017 18:11:03 +0100 Message-ID: <1497978663.21214.123.camel@ipfire.org> In-Reply-To: <1497900050-27692-1-git-send-email-jonatan.schlag@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3845179250896107919==" List-Id: --===============3845179250896107919== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi, did you not like these? http://git.ipfire.org/?p=3Dnetwork.git;a=3Dblob;f=3Dsrc/functions/functions.l= ock;h=3Dfac86bddc336a6d1dd13d0e95f8c6ad683ccbaad;hb=3DHEAD -Michael On Mon, 2017-06-19 at 21:20 +0200, Jonatan Schlag wrote: > This function easily lock or unlock a file. >=20 > Signed-off-by: Jonatan Schlag > --- > =C2=A0src/functions/functions.util | 14 ++++++++++++++ > =C2=A01 file changed, 14 insertions(+) >=20 > diff --git a/src/functions/functions.util b/src/functions/functions.util > index 4b6f956..23e5a4b 100644 > --- a/src/functions/functions.util > +++ b/src/functions/functions.util > @@ -738,3 +738,17 @@ hex2dec() { > =C2=A0dec2hex() { > =C2=A0 printf "%02x\n" "${1}" > =C2=A0} > + > +lock_file() { > + assert [ $# -eq 1 ] > + local file=3D${1} > + > + touch "${file}.lock" > +} > + > +unlock_file() { > + assert [ $# -eq 1 ] > + local file=3D${1} > + > + rm -f "${file}.lock" > +} --===============3845179250896107919== Content-Type: application/pgp-signature Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="signature.asc" MIME-Version: 1.0 LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KVmVyc2lvbjogR251UEcgdjIKCmlRSWNCQUFC Q2dBR0JRSlpTVmNuQUFvSkVJQjU4UDl2a0FrSDgyUVAvait1elJ2WFV3UGx3UUZDNWNFN2lRc00K THZTMVVwWDFTK1FlcFdOellLclRiMVNLSmdXNVpTOXFLNTBLM3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