linux - What is the best way to work with console application runned in background in php? -


i have task write "control panel" on php, work linux console-based application, game server. so, need start, stop (no problem there), , work console of application - send string commands it, , catch output.

what best way it? think creating .sh scripts/templates, , call php shell_exec commands - simplest way. how implement work console - best way send commands , catch output? call "fg" before running script , "bg" after? use screens , switch it?

what best way this?

the best way run "other application" daemon in background, , communicate via socket (tcp, unix, ..).

this done quite if develop console-based application too. if don't, , application reading/writing stdin/stdout, build other controller process exposes these 2 i/o channels on socket.

the first idea tough python script uses subprocess module run other process in background , communicate it. then, make python script open socket dialogate php application (of course should able in favourite language. mine python :)).


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -