Friday 22 March 2019

How to make backgroud process in php using shell_exec

Create background.php file
<?php
$post_id = ['post_id'=>10];
$post_id = json_encode($post_id);
$pid = shell_exec("php /var/www/html/magento/dump/exportfile.php $post_id alert >> /var/www/html/magento/dump/test.log & echo $!");
echo $pid;
Create checkprocess.php file
$pid = 1254; // Copy pid from background.php
if (file_exists("/proc/$pid" )){
    echo "process with a pid = $pid is running";
}
 Create exportfile.php file
//Create this file with high time taking script

1 comment:

  1. Cosmo Casino has the higher hand on players’ preferences for some of its games accessed via the mobile 카지노 사이트 추천 app that doesn't require an internet connection. On the other hand, Yukon Gold is a well-trusted and approved platform; your deposits and cash withdrawals are safe and risk-free. It is owned by Fresh HoriZon Limited and has been licensed by the Kahnawake Gaming Commission.

    ReplyDelete