my idea is to start a minecraft server with the Symfony2 Process Class and want to give feedback to me in real time. So, like described in the Process cookbook part, I try the following code:
$process = new Process('sudo java -jar -Xms512M -Xmx1G ../server/minecraft_server.jar');
$process->setTimeout(null);
$process->run(function ($type, $buffer) {
if ('err' === $type) {
echo 'ERR > '.$buffer;
} else {
echo 'OUT > '.$buffer;
}
});
Because of some permission issues with the apache2 user i modified the sudoers file with this: www-data ALL = (myspecialUser) NOPASSWD: /usr/bin/java
so the www-data user can run the java command.
The server is starting in the background, but my problem is now that I'm not getting any real-time output. Only if I shutdown (or kill) the minecraft server process I get the output.
Any suggestions how to get a real-time output?