LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 12-14-2009, 11:59 AM   #1
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,681
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
starting background programs with screen


My current setup involves a kernel hack (patch) I wrote that creates an ioctl() call, and a program that calls which can be run from a shell script ... which logs in to a text console TTY, runs screen, and runs the (often interactive) program within screen in the shell screen started. This works well so far.

I'm moving away from using text console and would also like to deprecate the kernel hack (though if someone still wants it, they are welcome to have it). So I'm looking for a way to start screen to do this directly. It has to start things detached. The script that feeds input will exit when the input is done (so this is NOT a script that replaces the shell being run inside screen's session). The commands fed to that session will run one or more programs through a shell and usually leaving the programs running. I should be able to attach a screen client to that session, kill the program with Cntrl-C, get the shell prompt, and do whatever I want there. Again, this is NOT a script to be run inside the session, but rather, one that provides keystroke input to that session, much like an expect script (although at present I don't need to do any handling of the output to decide on inputs, so I don't need to run expect).

Anyone know how to do this in screen? The script that starts it (usually at system boot time) won't know which PTY is allocated, so it can't just open the PTY end and stuff inputs there.
 
Old 01-04-2010, 09:50 AM   #2
jessed
LQ Newbie
 
Registered: Dec 2006
Location: Olympia, WA
Distribution: Ubuntu
Posts: 4

Rep: Reputation: Disabled
If I'm reading this correctly, you're trying to accomplish two things:

1) Identify the pty used by the screen session.
2) Send arbitrary cli input to the session programmatically.
3) Be able to attach to that session at will and get to a CLI, meaning that the session is the script on top of a normal shell (bash or whatever).

Is that summary correct?


--jesse
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Running Terminal Programs in the Background with Screen LXer Syndicated Linux News 0 08-24-2006 06:54 PM
Starting Skype from Background nedson Linux - Newbie 1 04-20-2006 03:53 AM
Starting program in background jdhar Linux - Software 1 02-21-2005 02:12 PM
background programs comp_brad1136 Linux - Newbie 6 11-03-2004 05:45 PM
Run programs in background... Cybers19 Linux - Newbie 1 06-02-2004 03:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 02:27 AM.

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