I would like to control a screen session (A) from another screen session (B). Therefore I wrote a little script that I will run in session B:
#!/bin/sh
clear
while :
do
screen -S SessionA -X stuff '^C'
screen -S SessionA -X stuff 'java -jar jarFile.jar'
screen -S SessionA -X stuff `echo -ne '\015'`
sleep 30
done
So it basically ends the current process of session A and restarts it by sending the java command and an Enter-stroke.
Sending the enter-stroke by using echo -ne '\015'
worked flawlessly in the terminal. However, it does not work from the script.
Does anyone know either:
How to send a command to a screen session from a script or simply
How to send an Enter-stroke to a screen session from a script?