Find process ID of a background process
<p>I am execute a infinite while loop from command line that would execute a rest call with the use of CURL . I'm redirecting the rest o/p to a file . I have appended an "&amp;" at the end of the command so that it goes into background.
Unfortunately, the terminal was exited .
But I see the process is still writing the o/p to the file continuously . 
However I don't see any background jobs running with the command job.
Even I used <strong>ps/lsof/fuser</strong> to find the process ID so that I can manually kill it.
But none of the commands returned me the process ID. 
I even tried changing the file to read only mode, but still I see the file continuously growing.</p>

<p>At last I found chattr command that would restrict the file from being written.</p>

<p>But in this case where would I find the process ID that is responsible . </p>

<pre><code>touch /var/log/test_mon_vm.log;while true; echo "start....." &gt;&gt;/var/log/test_mon_vm.log;echo $(date) &gt;&gt; /var/log/test_mon_vm.log; do /usr/bin/curl -I --user rhqadmin:rhqadmin http://localhost:7080/rest/plugins?name=Samba 2&gt;/dev/null | head -n 1 &gt;&gt; /var/log/test_mon_vm.log; echo "end....." &gt;&gt; /var/log/test_mon_vm.log;echo &gt;&gt;/var/log/test_mon_vm.log;echo &gt;&gt;/var/log/test_mon_vm.log;sleep 1;done &amp;
</code></pre>