title: Python code to check if service is running or not.?
body: <p>I am using python2.7 to check if a service is running or not. I have made my own service and placed it inside <code>/etc/init.d</code>. I have a raspberry on which I am using it.</p>
  
  <p>Now to normally check the status of service, we can do:</p>
  
  <pre><code>service my_service status
  </code></pre>
  
  <p>But how can I get the status of service from the python code.</p>
  
  <p>Thanks</p>