LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Screen Commands (https://www.linuxquestions.org/questions/linux-software-2/screen-commands-657757/)

xeross 07-23-2008 02:16 PM

Screen Commands
 
Hey,

I need some help with screen i need to know how to do the following(from outside screen)

1. create a detached screen session.
2. execute a command in the first window of that screen session
3. execute a command in the second window of that screen session
4. stop the progress in the first window of the screen session just like if you would press ctrl+c
5. stop the progress in the second window of the screen session just like if you would press ctrl+c
6. Exit the screen session

Thanks for your time, Xeross

clint1986 07-23-2008 02:37 PM

You can find all the information you need by reading the man pages for Screen. At the console, do the following:

Code:

man screen
It's all in there and it's explained really well. Come back if you have any trouble. Good luck. :)

xeross 07-23-2008 02:55 PM

Already tried some commands but they didnt work.

clint1986 07-23-2008 03:25 PM

What did you try? What happened when you tried?

In answer to your first question, I think you need to run Screen with the -d -m parameters. For example:

Code:

screen -d -m
The above would start a Screen session but not attach to it. Then you would do this:

Code:

screen -r
And you would find yourself in that Screen session you just made. Using -d -m is good for startup scripts. You can have Screen load Irssi (an IRC client) in the background and then you attach to to when ready later on. For example:

Code:

screen -d -m irssi
In answer to your second question, to run a command straight away in Screen, just type the command right after the screen command. For example:

Code:

screen nano /etc/hosts
The above would start a screen session running the Nano editor with the /etc/hosts/ file open and ready for editing.

Hopefully that should get you going in the right direction. Peace. :)

xeross 07-23-2008 03:37 PM

Ye i figured it out till there but i dont want multiple sessions i want a session created with the
Code:

screen -d -m
and then in that session create a second window and execute something in both windows from outside screen

clint1986 07-23-2008 03:57 PM

I'm not sure what you are trying to do but I'm pretty sure it goes beyond my expertise with Screen. You will need to wait until someone more experienced comes along to help you, or poke around the man pages a little more.

I'm pretty tired here and need to rest, otherwise I'd have a go figuring it out myself. Sorry. :(

xeross 07-24-2008 05:29 AM

ok here's what i got

Code:

# Go to the correct directory(Normaly you could put the full path in the sudo command but not with this

program)
cd /home/WoW/Silvermoon/bin

# Create a new detached screen session called BGSession
screen -S BGSession -d -m

# Start the logonserver on the first page
screen -r BGSession -p 0 -X sudo -u wow ./arcemu-logonserver

# Start the worldserver on the second page
screen -r BGSession -p 1 -X sudo -u wow ./arcemu-world

the creation works fine but the logonserver nor the worldserver starts


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