Due to Gnu Screen being hard to Google for, I've been having trouble finding an answer to this one.
As a concrete (what are you trying to do) example:
Running a server process (under linux) starts up a bunch of output (STDOUT STDERR) which can take input from STDIN.
Periodically I want to issue a command (
/snapshot) to backup the current state.
I want to setup cron to run a command that occasionally injects this into the STDIN for the server.
So far I've been thinking that the server process could run in a detached screen session. And I think that screen's exec command can connect to different terminal sessions under screen and hand STDIN and STDOUT to another process. But reading the docs has been confusing. And it doesn't help that they say there's a "confusing illustration" to explain this further.
If anyone has done this, how do I specify a cron command to accomplish this. So far I'm thinking (show what you've done):
5 * * * * /usr/bin/screen -p 1 -X 'exec ! echo "/snapshot"'
But here I don't know if that'll work, if that would actually target the server process in window 1, and what happens after that; does screen exit?