<?php
require_once("../config/connect.php");
require_once("../global_functions.php");
ini_set('memory_limit', '-1');
set_time_limit(60); //TODO: set to -1

/*function detached_exec($cmd) {
    $pid = pcntl_fork();

    switch ($pid) {
        case -1: return false;
        case 0:
            posix_setsid();
            exec($cmd);
            break;
        default:
            return $pid;
    }
}    

$pid = detached_exec('C:\xampp\htdocs\sitpos_2.10\synchronize\test.bat');

if ($pid === FALSE) {
    echo "exec failed";
}

posix_kill($pid, SIGINT);
waitpid($pid, $status);

echo "Child exited with " . $status;*/

//echo system('cmd /c START C:\xampp\htdocs\sitpos_2.10\synchronize\exec.bat');
//echo exec('C:\xampp\htdocs\sitpos_2.10\synchronize\exec.bat');
//echo shell_exec('C:\xampp\htdocs\sitpos_2.10\synchronize\test.bat');
?>