I have task to write some "control panel" on php, to work with linux console-based application, game server. So, i need to start, stop (no problem there), and work with console of application - send string commands to it, and catch an output.
What is the best way to do it? I think about creating some .sh scripts/templates, and call it with php shell_exec commands - it will be the simplest way. But how to implement work with console - what is the best way to send commands and catch an output? Call "fg" before running script and "bg" after? Use screens and switch to it?
Bunu yapmanın en iyi yolu nedir?