Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a Java app running in a screen session (A game server), and I'd like to be able to write a script to send commands to it periodically (with cron probably), but I'm not sure how to send commands to a running screen session.

Is this possible? Might be complicated by the fact that I'm not just sending more shell commands to the screen, but putting text into the running Java console.

share|improve this question
add comment

1 Answer

Try this example from screen faq:

screen -S test -p 0 -X stuff 'top^M'

It will run top command in the screen session named test.

^M is a control character you can put by pressing CTRL+V, ENTER in bash.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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