title: Bash how to get full script name from PID
body: <p>I have this php function that checks the script's name from the given PID, and compares it to itself.</p>
  
  <pre><code>function isRunning($pid) {
      $filename = exec('ps -p '.$pid.' -o "%c"');
      $self = basename($_SERVER['SCRIPT_NAME']);
      return ($filename == $self) ? TRUE : FALSE;
  }
  </code></pre>
  
  <p>From what I know, I usually use this command to get the script name from the PID:</p>
  
  <pre><code>ps -o PID -o "%c"
  </code></pre>
  
  <p>It returns me the filename, but only the first 15 characters.
  Since my script's name is </p>
  
  <blockquote>
    <p>daily_system_check.php</p>
  </blockquote>
  
  <p>the function always returns FALSE, because it's comparing itself with </p>
  
  <blockquote>
    <p>daily_system_ch</p>
  </blockquote>
  
  <p>Is there another bash command for Centos 6 that will return me script's full name?</p>