I have to run a PHP script as a service. Also it should be run on start up too (when a system crash/rebbot occurs). I tried with a cron job that runs once in a year. Once the cron triggered the process, I commented out it while running the process. But after a system reboot process stopped.
I tried this also but after closing the terminal process got stopped. Also I am not sure it will run on start up or not? Following is my php script.
<?php 
   while (true) {
      $command = "php $cwd\artisan synchronizedb --ptype=2";
      exec($command);
   }
?>
 
     
     
    