So I have an automatic backup script hourly backing up important files of the server.

It has many lines like this that send input to the screen session the game server console is running in to broadcast when it starts to backup the files:

screen -x $SCREENNAME -X stuff "`printf "say Backing up world: \'$WORLD\'\r"`

It works fine, unless I'm using a different window inside of the screen session.

When I'm using a different window in the same screen session the script tries to execute the say Backing up world in the bash terminal I'm using which doesn't work and no message gets sent to the game console.

Is there any way to direct the output to a specific screen inside the seesion. My game console is always on the first screen so screen 0.

I'm on CentOS 7 if that's relevant


You can preselect a window by specifying -p , 0 is first window, 1 is second so on...

screen -x $SCREENNAME -p 0 -X stuff "printf "say Backing up world: \'$WORLD\'\r""

  • So my screen now has this in it screen -p 0 -S ${SCREENNAME} -X eval 'stuff \"helpop ${SAY_BACKUP_START}\"\015' But it still keeps inputting the things to the window that I have currently selected instead of window #0 – Tundral Apr 28 '18 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.