<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="/rss.xsl"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Lockfile on Raveen Kumar</title>
    <link>https://raveenkumar.com/tags/lockfile/</link>
    <description>Recent content in Lockfile on Raveen Kumar</description>
    <generator>Hugo</generator>
    <language>en-US</language>
    <copyright>Raveen Kumar</copyright>
    <lastBuildDate>Fri, 17 Feb 2023 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://raveenkumar.com/tags/lockfile/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Lockfile</title>
      <link>https://raveenkumar.com/library/programming/lockfile/</link>
      <pubDate>Fri, 17 Feb 2023 00:00:00 +0000</pubDate>
      <guid>https://raveenkumar.com/library/programming/lockfile/</guid>
      <description>&lt;h2 id=&#34;lockfile&#34;&gt;&lt;code&gt;lockfile&lt;/code&gt;&lt;/h2&gt;&#xA;&lt;h3 id=&#34;installation&#34;&gt;Installation&lt;/h3&gt;&#xA;&lt;p&gt;&lt;code&gt;sudo apt install procmail&lt;/code&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;description&#34;&gt;Description&lt;/h3&gt;&#xA;&lt;p&gt;&lt;code&gt;man lockfile&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Suppose you want to make sure that access to the file &amp;ldquo;important&amp;rdquo; is&#xA;serialised, i.e., no more than one program or shell script should be&#xA;allowed to access it. For simplicity&amp;rsquo;s sake, let&amp;rsquo;s suppose that it is a&#xA;shell script. In this case you could solve it like this:&lt;/p&gt;&#xA;&lt;pre&gt;&lt;code&gt;...&#xA;lockfile important.lock&#xA;...&#xA;access_&amp;quot;important&amp;quot;_to_your_hearts_content&#xA;...&#xA;rm -f important.lock&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;p&gt;Now if all the scripts that access &amp;ldquo;important&amp;rdquo; follow this guideline,&#xA;you will be assured that at most one script will be executing between&#xA;the &lt;code&gt;lockfile&lt;/code&gt; and the &lt;code&gt;rm&lt;/code&gt; commands.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
