<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>IT notes - pwait</title>
    <subtitle>DBRE, AWS platform engineering, PostgreSQL, Linux, FreeBSD, and Rust reference notes.</subtitle>
    <link rel="self" type="application/atom+xml" href="https://nbari.com/tags/pwait/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://nbari.com"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2017-11-11T09:27:21+01:00</updated>
    <id>https://nbari.com/tags/pwait/atom.xml</id>
    <entry xml:lang="en">
        <title>Wait Process to Finish</title>
        <published>2017-11-11T09:27:21+01:00</published>
        <updated>2017-11-11T09:27:21+01:00</updated>
        
        <author>
          <name>Unknown</name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://nbari.com/wait-process-to-finish/"/>
        <id>https://nbari.com/wait-process-to-finish/</id>
        
        <content type="html" xml:base="https://nbari.com/wait-process-to-finish/">&lt;p&gt;Cross platform solutution:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;while kill -0 PID 2&amp;gt; /dev/null; do sleep 1; done;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ sleep 60 &amp;amp;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ while kill -0 $!; do echo 1 &amp;amp;&amp;amp; sleep 0.5; done&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If using FreeBSD:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;pwait&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Also &lt;code&gt;lsoft&lt;/code&gt; can be used but requires that the &lt;code&gt;$pid&lt;/code&gt; has open files:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;lsof -p $pid +r 1 &amp;amp;&amp;gt;/dev/null&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        
    </entry>
</feed>
