I would like to send a command to a screen session and if possible get the output.
My attempt at sending a command to a screen session is as I found on this website and lots of others, but it doesn't seem to work:
root@server [~]# screen -X "script -a -c 'ls -l' /tmp/command.log" && cat /tmp/command.log
cat: /tmp/command.log: No such file or directory
root@server [~]#
Note there is on
This is driving me nuts. I run an opensim server on system, and currently have a watchdog script used to check that the server is running and either run it or re-start it as necessary (in the event of a server crash).The server itself is run in a gnu screen session so that I can log in to the server remotely via ssh. At the moment I run my watchdog at login, which is not ideal.
We have a long running process on a remote server which is kicked off manually from time to time. Unfortunately internet connections die, kernels panic and a whole host of other challenges can be encountered by the ssh session used to connect and start the job.
Screen seems like a perfect way to ensure the process isn't interrupted.
I'm trying to make a startup shell script(s) for a vpn. Upon startup, I would like the scripts to check for a detached screen session (named 'main'). If there is one, make another screen in it (not a new separate session, would like to use 'screen -x' and then scroll through the screens in one session) and run the desired commands.
Im making a shell script which will open a already running screen session, I want it to output something in this screen session using shell.
All help is appreciated
I use the screen program extensively. It has helped me tremendously by reducing the time spent in setting up session every day. However, now that I have >8 screens - I forget sometimes which screen I am in. Is there a way to find the name of the screen session that I am working in.
Installed McMyAdmin (minecraft manager) on Ubuntu 12.04 32 bit.
Wrote my own service to start McMyAdmin (.net app running in Mono) in its own screen session, and be able to inject proper McMyAdmin commands into that session with the init.d script.
I would like to know if there is a way to get tmux to behave like screen -D -R so I could say, have the command as a default command in Putty.
These screen switches would force detach of an existing screen session for my user (even if it was still active and logged-in somewhere else) and reattach it to the current session.
I'm looking to switch from screen to tmux for my terminal multiplexing needs, but there's a feature of screen that I need to replicate in tmux: the -X option, which allows one to run arbitrary screen commands inside an existing screen session.