LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   sending commands to a screen (http://www.linuxquestions.org/questions/slackware-14/sending-commands-to-a-screen-4175434836/)

fatalerror0x00 10-30-2012 10:23 PM

sending commands to a screen
 
I have a screen I use for my minecraft server so it is a java file running and it doesn't totally act like a terminal (I think). So give me what you got and I'll try it. I need to be able to send a command like stop to a screen called PhantasyCraft. the last time I did this though it sent the whole screen -argument and blah blah blah to the terminal and said it wasn't valid (Minecraft said it wasn't not the operating system). so it's not just sending stop it's sending something else with it too which is making it not work.
also just to make sure we have an understanding this screen isn't attached and nor do i want to attach it to run some commands. thanks :)

evo2 10-30-2012 11:15 PM

Hi,

please define what you mean by "screen". A physical display, an xterm, "gnu screen" etc.? If you are unable to tell us what a "screen" is, please be very explicit about what you are doing.

Evo2.

fatalerror0x00 10-31-2012 12:15 AM

Well I would have assumed youd know i was talking about the screen command from the details I gave so it's not enough but I mean when you use the command screen to run programs in (used more commmonly with ssh since you don't have tty's in ssh (as far as I know) :P

evo2 10-31-2012 12:39 AM

Hi,

ok, so you are talking about GNU screen. How exactly are you trying so send the command? Eg do you do something like
Code:

screen -S sessionname -p 0 -X somecommand
?
Exact commands and error messages would be useful.

Evo2.

fatalerror0x00 10-31-2012 01:01 AM

screen -S sessionname -p 0 -X somecommand <- that syntax does nothing when I replace sessionname with the name of my session (PhantasyCraft) and somecommand with stop which is the command I would like to send the screens "terminal" I put that in quotes because I'm not sure what it is as you can't do ls rm mv cp df mkdir touch and commands like that in this terminal because a java file is running and made it's own sort of terminal it seems

fatalerror0x00 10-31-2012 01:34 AM

I figured out a way to do it now it's been infront of me kinda all along I just idk what happened but it works now and I know what to do :) thanks guys

gnashley 10-31-2012 12:04 PM

Please post what worked for you, so that others searching through threads can find your solution.

fatalerror0x00 10-31-2012 01:47 PM

Right sorry :P I did

screen -S PhantasyCraft -X stuff "command^M"

^M can be gotten by typing it in manually or pressing control + V then control + M

Commmand is replaced with the command you want to send to the screen in my case stop is the command.

^M is like pressing enter so that it doens't just send the text to it but also runs the command

Hope this helps anyone that looks at this and needs this solution :)


All times are GMT -5. The time now is 12:49 AM.