LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 08-22-2006, 07:32 AM   #1
samel_tvom
Member
 
Registered: Aug 2004
Posts: 133

Rep: Reputation: 15
multiple "screen -d -m" but only one session


Hey!

I have this script:

#!/bin/bash

for i in $@
do
screen -d -m btdownloadcurses $i
done


This is nice BUT I would like to have _one_ screen sessions with
multiple windows, containing those btdownloadcurses processes 'cause it much eaiser and faster to switch between them then.


How do I do this?

Thanks!
 
Old 08-22-2006, 12:58 PM   #2
ciotog
Member
 
Registered: Mar 2004
Location: Canada
Distribution: Slackware current
Posts: 728
Blog Entries: 2

Rep: Reputation: 43
Just from quickly reading the screen man page, maybe you could adjust the screen line of the script as follows:
Code:
screen -p 0 -d -m btdownloadcurses $i &
 
Old 08-23-2006, 02:37 AM   #3
samel_tvom
Member
 
Registered: Aug 2004
Posts: 133

Original Poster
Rep: Reputation: 15
But I think you have to name the session to reattach to then, since -d -m starts a new session. But yeah, that could work. To first create a screen session than to reattach (but in a detached mode =) ) with -D -m -p $nbr where nbr should increase by one each "for-loop-round".

I will check that out, but I found another way. So if others have this problem I, changed the script, it now looks like this:

Code:
#!/bin/bash

######## BEGIN CONFIGS #####################

#what program to run
program=btdownloadcurses
#dir to put conf files in
dir=/tmp/screenscript

######## END CONFIGS   #####################

# create the dir where we put our config files
if [ ! -d $dir ]; then
        mkdir $dir
fi

# find a file that does not exist
# that will be our conf file
nbr=0
while [ -e $dir/$nbr ]; do
        let nbr++
done

conf=$dir/$nbr
touch $conf

echo source ~/.screenrc >> $conf

win=0
for i in $@; do
        echo screen $win $program $i >> $conf
        let win++
done

# start screen
screen -c $conf -S screenscript
 
  


Reply

Tags
multiple, screen, windows


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
Fedora Core 2: Screen Resolution can not change from "800X600" to "1024X 768" suhaimi_sj Fedora - Installation 18 12-17-2009 03:29 AM
"mythtv-setup" giving "Session management error: Authentication Rejected" Mitchua Ubuntu 0 10-09-2005 04:32 PM
KDE "Logout" and "Lock Session" menu restoration powah Linux - Software 3 03-29-2005 08:02 PM
KDE "Lock Session" and "Logout" menu restoration tcma Linux - Software 0 01-29-2005 11:12 AM
Undefined Screen " XFree86" reference by serverLayout "XFree86 Configured" comox *BSD 7 01-17-2005 05:47 PM

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

All times are GMT -5. The time now is 10:36 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration