I am using Screen like this:
screen -L -dm -S session1 -c "./game_server -options"
to wrap around game servers. I log their output to a file and can send them input with:
screen -r session1 -p0 -X "stuff \"this into input^M\""
The timeout between log file flushes can be specified in the configuration file (10 seconds in my case).
The problem I have is that I can't force screen to flush output to the logfile. For example, after I send a "status" command to a game server, the game server prints some information, but it takes at least 10 seconds to add that to the log file.
I have tried sending:
screen -r session1 -p0 -X "logfile flush 1"
But it doesn't react to that. I've also tried flush 0 with no luck.
I wouldn't want to always log with a timeout of 1 second; it's only really needed after receiving a command. Note that I'm paranoid about performance here because the session is running a game server after all.
How can I force screen to flush output to the logfile? Is there a way to do what I need (log output to file and send commands to input) other than with screen, maybe with a FIFO?