title: How to stop python script when run it from Website (php)
body: <p>My Project is Lighting Control on Rasp Pi
  by use Rasp Pi as Web Server &amp; Control the light by python script
  I use the UI on PHP Website to control the light</p>
  
  <p>Here is my php code</p>
  
  <pre><code>&lt;?php
      public function auto1()
      {   
          system('sudo -u root -S python /var/www/4led/chktime1.py');
      }
  
      public function disauto1()
      {   
          system('echo raspberry | sudo -u root -S pkill -f chktime1.py');
      }
  ?&gt;
  </code></pre>
  
  <p>when I press the on button on website to turn auto script It call auto1 and work correctly but this is loop script (I intend to make it loop alltime) but when I press the off button It can't close it because the loop of chktime1.py is still working and cannot open other script or command in disauto1. How can I stop this script from PHP command. </p>
  
  <p>Thank you for your helping </p>