title: fetching a http process user using bash
body: <p>Whats the best way to fetch a web process user (apache|nginx|www-data) for bash script usage? </p>
  
  <p>In my case for setting up folder permissions and changing to the poper owner.</p>
  
  <p>Currently I'm using:</p>
  
  <pre><code>ps aux | grep -E "(www-data|apache|nginx).*(httpd|apache2|nginx)" \
  | grep -o "^[a-z\-]*" | head -n1
  </code></pre>
  
  <p>inside a bash script to fetch the owner of the http process.</p>
  
  <p>Any hints on a more smartly solution or a better regex whould be great.</p>