I am currently using PHP exec() to call nohup command that execute a jar file as a background task on the server and get process PID,However it seems there are something incorrect with my script that the command doesn't get executed.
my code looks like this:
$command="nohup java -jar /path/to/jarfile/search.jar -k='keyword' -lang='en' -dir='/out' -profile='n' > outputlog.out 2>&1&";
exec($command);
However,when I try to execute the command without the "> outputlog.out 2>&1&" it works fine.but it will occuping the webpage till it finishes,which it not i want.
Can anyone help?