LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-14-2012, 08:20 PM   #1
metaf5
LQ Newbie
 
Registered: Aug 2011
Distribution: I'm kind of fond of Crunchbang...
Posts: 19

Rep: Reputation: Disabled
GNU Screen: send "stuff" command to detached screen session?


When I try to "stuff" text into a detached screen session using the command:

screen -XS $sessionName stuff "$text `echo -ne '\015'`"

It doesn't seem to do anything. But, if I first attach to the screen, do nothing, then detach it, and run the command again, it seems to work reliably. Does anyone know why this is?
 
Old 01-14-2012, 09:07 PM   #2
hololeap
LQ Newbie
 
Registered: Oct 2011
Location: Colorado, USA
Distribution: Gentoo, Ubuntu
Posts: 13

Rep: Reputation: Disabled
No idea. I played around with it and I couldn't figure out how to get the paste or stuff commands to work on a session started with "screen -d -m". I'm guessing there's some kind of flag that gets set when you first make user interaction that activates the input buffer. I would try something else, or ask the GNU screen developers.
 
Old 01-20-2012, 01:56 AM   #3
geomaster
LQ Newbie
 
Registered: Jan 2012
Location: Russia
Posts: 1

Rep: Reputation: Disabled
Workaroud

$ screen -dmS spawner sleep 30
$ screen -S spawner -X screen screen -dR mydaemon
$ sleep 1
$ screen -S mydaemon -X detach
$ screen -S mydaemon -X stuff "whatever"

It's work for me, but need some small changes for my scripts - send 'exit\015' to spawned screen

Last edited by geomaster; 01-20-2012 at 01:58 AM.
 
1 members found this post helpful.
Old 01-23-2012, 08:44 PM   #4
metaf5
LQ Newbie
 
Registered: Aug 2011
Distribution: I'm kind of fond of Crunchbang...
Posts: 19

Original Poster
Rep: Reputation: Disabled
This works excellently. I'll test it soon and see if things get odd when I start running multiple instances of the script that starts other screens(and in the process, spawners). Thanks a lot!
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to send a command to a screen session? ThaHabbis Linux - Software 9 02-01-2014 05:01 AM
Using ssh over SecureCRT to connect into a "screen" session Jusctsch Linux - Software 1 10-09-2011 05:47 AM
How to close "screen" session from a script? taylorkh Linux - Newbie 9 06-27-2011 06:05 PM
slackware 12.1 blank screen after clicking "end current session" nick_slack Slackware 7 05-25-2008 09:01 PM
multiple "screen -d -m" but only one session samel_tvom Linux - Software 2 08-23-2006 02:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:06 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