LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-15-2014, 06:07 AM   #1
jason.mobile.iphone
LQ Newbie
 
Registered: May 2014
Posts: 3

Rep: Reputation: Disabled
"screen" command not sending from register or paste until after attach/detach


I'm trying to run a server process through screen.
I start this via upstart with:

exec su myuser -c "screen -S sessionname -D -m $JAVA -server -Xmx12G -Xms12G -jar $JAR nogui"

This seems to work fine. The server process is running and the "screen -list" command shows my screen session present and it is detached.

I then attempt to send commands to the server process, which reads them from stdin, via:

screen -d -r sessionname -X register c "say ** Testing **$(echo -ne '\r')"
screen -d -r sessionname -X paste c

Both of the above commands exit with 0 exit status. But they do not appear to work. Nothing is pasted into the screen session.

If I then use another terminal to attach and detach via:

screen -d -r sessionname
<this goes interactive to attach, then I issue ctrl-a-d to detach>

I am then able to successfully use the previous flow for register/paste and my commands are sent to the server process correctly.

Any ideas how to fix this?
 
Old 05-23-2014, 01:49 PM   #2
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,491
Blog Entries: 2

Rep: Reputation: Disabled
Hey Jasons iphone, can you hear me now?
Quote:
exec su myuser -c "screen -S sessionname -D -m $JAVA -server -Xmx12G -Xms12G -jar $JAR nogui"
Try instantiating screen with the -a switch included. I think you might be getting output on the initial detached session but without loading the complete $TERMCAP on it you're not able to see it.
If you can select text on the initial detached session, see if you can get it to highlight or at least highlight the lines it would be pasting on the screen if it could figure out how to do that.

By the way, thank you for bringing screen to my attention, I'm going to do some serious geeking with this thing this weekend.

Last edited by dijetlo; 05-23-2014 at 02:01 PM. Reason: Developed a stutter....
 
Old 05-26-2014, 12:09 AM   #3
jason.mobile.iphone
LQ Newbie
 
Registered: May 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thanks for the reply.

I found my answer here

http://serverfault.com/questions/104.../327820#327820

And here

http://serverfault.com/questions/104...taching/327820


Basically I needed to specify the "-p 0" parameter to tell it which "window" to use. Whatever that means.

This is odd to me, because this exact same set of scripts worked for me until I migrated everything to a new Ubuntu server (which was 64 bit rather than my older 32 bit server)

Quote:
Originally Posted by dijetlo View Post
By the way, thank you for bringing screen to my attention, I'm going to do some serious geeking with this thing this weekend.
TBH I'm not really a fan of this "screen". Though this is more because of why I have to use it. Perhaps it has better applications.
I've been a linux user for over 10 years now and have not had need to use this utility before.

I'm hosting a minecraft server for myself and some friends.
The minecraft server takes server commands from stdin from the running server process. IMHO that is a design flaw. It would be easier to script commands through things like cron or elsewhere without dealing with "screen".

Thanks again
J
 
Old 05-27-2014, 10:18 AM   #4
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,491
Blog Entries: 2

Rep: Reputation: Disabled
Quote:
Basically I needed to specify the "-p 0" parameter to tell it which "window" to use. Whatever that means.
Your X server is generating multiple windows (think of them as "desktops" in the GUI) though I've more often seen them referenced by monitor:window so the first desktop on the first monitor would be 0:0. I might be wrong, I'm going to have to mess with it when I get a chance.

Quote:
takes server commands from stdin from the running server process.
All the server processes do, that's why you can do thing's like sighup the inetd server from the command line. What screen is doing is allowing you to centrally access that facility on multiple servers in multiple locations simultaneously without having to script a solution (tee for example), you can configure it on the fly and toss it onto a fresh screen to monitor the interactions.
Thanks for the links, I'll check them out.

Last edited by dijetlo; 05-27-2014 at 10:19 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
GNU Screen: send "stuff" command to detached screen session? metaf5 Linux - General 3 01-23-2012 08:44 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
LXer: Tips and tricks: How do I use the "xm block-attach" command to attach additiona LXer Syndicated Linux News 0 08-21-2007 12:50 AM
How do i "copy" one bios and "paste" it onto another identical machine Yerp Linux - Hardware 2 01-10-2007 08:31 PM
Attach a Attachment with the " mail command" robinhood1995 Linux - General 2 05-16-2002 11:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration