title: How to check if another instance of my shell script is running
body: <p>GNU bash, version 1.14.7(1)</p>
  
  <p>I have a script is called "<code>abc.sh</code>"
  I have to check this from <code>abc.sh</code> script only...
  inside it I have written following statement</p>
  
  <pre><code>status=`ps -efww | grep -w "abc.sh" | grep -v grep | grep -v $$ | awk '{ print $2 }'`
  if [ ! -z "$status" ]; then
          echo "[`date`] : abc.sh : Process is already running"
          exit 1;
  fi
  </code></pre>
  
  <p>I know it's wrong because every time it exits as it found its own process in 'ps'
  how to solve it?
  how can I check that script is already running or not <code>from that script</code> only ?</p>