jimmyborofan Posted July 10, 2013 Share Posted July 10, 2013 I have a cron job that grabs a list of folders that need processingThese folders are scanned for a particular type of file and then those are processed.I am trying to get this to run as a parallel process by using exec.The complication arises when the it is called, it just doesnt seem to call the function.I use the codeigniter framework with the cli.php found on this very site (thank you whoever wrote that!)The loop works like this: public function loopBatchDir() { [...] begin Loop foreach ($batches as $batch) { exec("php /var/path/to/webroot/cli.php Controller backgroundProcess".$batch['filename'] . " > /dev/null &") } end Loop } public function backgroundProcess() { /*this is the test section */ echo "I have been called"; /*end test section*/ $batchFile = $this->uri->segment(4); $this->batch->insertBatchData() }SO when I call backgroundProcess() from the command line the I get the echo and the process executes (when providing a correct parameterWhen the loopBatchDir() is called by command line the entire process works fine, but the exec command is completley ignored.Other Info: This is on a fresh dedicated server that we have exclusive use of, I have had to make changes to several php settings and I am also wondering if exec is function that has to be turned on in php.ini?Any help, appreciated.Jim Quote Link to comment https://forums.phpfreaks.com/topic/280029-using-exec-from-cron-job/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.