Create background.php file
<?phpCreate checkprocess.php file
$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;
$pid = 1254; // Copy pid from background.phpCreate exportfile.php file
if (file_exists("/proc/$pid" )){
echo "process with a pid = $pid is running";
}
//Create this file with high time taking script