QA/Execution/Web Testing/Automation/Screen Tutorial: Difference between revisions

 
Line 41: Line 41:
To do this, the first thing you want to do is start an SSH session. This can be done with your favorite SSH client (Putty for Windows) or a simple ssh command in Terminal (OSX/Linux - type "ssh webqa@qa-selenium.mv.mozilla.com" and enter password). Once SSH'd into whichever box, you will be greeted with a blank shell, as if you just opened a new Terminal.  
To do this, the first thing you want to do is start an SSH session. This can be done with your favorite SSH client (Putty for Windows) or a simple ssh command in Terminal (OSX/Linux - type "ssh webqa@qa-selenium.mv.mozilla.com" and enter password). Once SSH'd into whichever box, you will be greeted with a blank shell, as if you just opened a new Terminal.  


If you want to simply view what may already be running (say if somebody else started RCs, etc), type "screen -ls" in the SSH window. This will print out a list of all the active screen sessions (think of them as the various tabs that you would see if you were to VNC into the machine). Now, to reattach to a specific screen session (analogous to clicking on the tab to bring it to the foreground and gain focus), you simply type "screen -x <session name>". The session name is what was displayed when you did the -ls. Once you do that, your terminal window will change to as if you had just switched tabs (so you'll see the process running, etc). You can interact with it as if you were working directly on the terminal window (so control+c to interrupt, restart by running whatever commands, etc).  
If you want to simply view what may already be running (say if somebody else started RCs, etc), type "screen -ls" in the SSH window. This will print out a list of all the active screen sessions (think of them as the various tabs that you would see if you were to VNC into the machine). Now, to reattach to a specific screen session (analogous to clicking on the tab to bring it to the foreground and gain focus), you simply type "screen -x <session name>". The session name is what was displayed when you did the -ls. Note that in certain cases, using the name will not work. So, you can instead use the process ID (the number right before the name). Once you do that, your terminal window will change to as if you had just switched tabs (so you'll see the process running, etc). You can interact with it as if you were working directly on the terminal window (so control+c to interrupt, restart by running whatever commands, etc).  


If you want to start a NEW screen session (particularly so that you can start a new RC, or after a fresh hard machine restart), then you type "screen -S <session name>". This tells the terminal that you want a new screen session (the same can be achieved by typing simply "screen", and the -S <screen session> allows you to name it so that you can tell what it is when you run a "screen -ls" command. If you leave out the -S flag, then the default name will be some number (process ID, maybe?) and identifying what that corresponds to without reattaching the screen is annoying. (Note that you will still see the number even if you use the -S flag when you -ls, and that you can reattach (see above) using either the session name OR the number.  
If you want to start a NEW screen session (particularly so that you can start a new RC, or after a fresh hard machine restart), then you type "screen -S <session name>". This tells the terminal that you want a new screen session (the same can be achieved by typing simply "screen", and the -S <screen session> allows you to name it so that you can tell what it is when you run a "screen -ls" command. If you leave out the -S flag, then the default name will be some number (process ID, maybe?) and identifying what that corresponds to without reattaching the screen is annoying. (Note that you will still see the number even if you use the -S flag when you -ls, and that you can reattach (see above) using either the session name OR the number.  
46

edits