LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-30-2015, 11:01 PM   #1
skoda
Member
 
Registered: Jun 2013
Posts: 111

Rep: Reputation: Disabled
Closing screen sessions


Hi folks,

i am new to screen command. i use screen command now frequently to monitor server logs in multiple split screens. but when i leave the office i just close the terminal. Is this ok or do i need to close that screen session?

Pls advise.
 
Old 12-01-2015, 12:26 PM   #2
Ihatewindows522
Member
 
Registered: Oct 2014
Location: Fort Wayne
Distribution: Ubuntu 16.04 LTS
Posts: 616
Blog Entries: 2

Rep: Reputation: 166Reputation: 166
Your description is a bit on the ambiguous side, but if I'm understanding you correctly, yes, you can close the terminal window. It may be best practice to lock your screen (usu. <CTRL> + <ALT> + <L> or from a menu). If you're opening another TTY session, you can just press <CTRL> + <D> to log out, and <CTRL> + <ALT> + <F7> to switch back to the GUI.
 
Old 12-01-2015, 12:32 PM   #3
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Is it your intention to close all sessions in the terminal?

If not, detach then exit using
Ctrl then A then D and then
Code:
exit
This leaves the screen running on the target.

If you intend to close them, then Yes, exiting your terminal is just fine (unless something is running in screen...?)
 
Old 12-01-2015, 11:11 PM   #4
skoda
Member
 
Registered: Jun 2013
Posts: 111

Original Poster
Rep: Reputation: Disabled
Thanks guys,

to be more ambiguous,

when i come to office, i open terminal, type Screen and execute few commands that monitor logs, for example :

#screen
#tail -f /var/log/exim_mainlog
Ctrl + a
ctrl + c
#tail -f /var/log/maillog
Ctrl + a
Ctrl + S [To split the screen]

now you can see two live monitoring services are runnign on.
when i leave the office, i just close the terminal.
on the next day, same procedure, i open terminal, type screen, and type above things.

now what my doubt is, the screen session which i started yesterday to montior the logs is still running on the target machine even after i close the terminal?








actually i close the terminal when leavign the office, so i think screen commands i executed
 
Old 12-02-2015, 07:29 AM   #5
maples
Member
 
Registered: Oct 2013
Location: IN, USA
Distribution: Arch, Debian Jessie
Posts: 814

Rep: Reputation: 265Reputation: 265Reputation: 265
If all you did was close the terminal window (with the X in the top corner) then the screen session is still running.
 
Old 12-02-2015, 10:27 AM   #6
debguy
Member
 
Registered: Oct 2014
Location: U.S.A.
Distribution: mixed, mostly debian slackare today
Posts: 207

Rep: Reputation: 19
Quote:
Originally Posted by skoda View Post
Hi folks,

>> when i leave the office i just close the terminal. Is this ok or do i need to close that screen session?

Pls advise.
it's ok...

but if you like what it does depends on your intent

example: i telnet to pheebor.com and login as foo, i run screen, and in one (window) i run updatedb(1) (builds db for locate(1). then i ponder logging out and it's effects.

it might be my intent if I ^D^D that terminates telnet on server side, that updatedb stops running ... it might be my intent it continues running

did i run
$ screen &
or
$ screen

and same question for apps run in screen. now also note sh(1) has forking and job control, and see sh(1) manpage about whether sh(1) will attempt to terminates job controlled jobs when it exists. (and that not all sh support job control, etc)

and the answer is simple: use ps(1) to see if screen closes (do this from a different console), and see if things screen was running that you didn't exist are active

if they are and you don't want that: well that's what GNU screen loves to do: gives you ways to do as intended with your virtual consoles in a console

Last edited by debguy; 12-02-2015 at 10:30 AM.
 
Old 12-02-2015, 11:39 AM   #7
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by maples View Post
If all you did was close the terminal window (with the X in the top corner) then the screen session is still running.
^ this

Use "screen -ls" to list your currently open screen sessions. You can reconnect to them with "screen -r name".

I'm a little confused though, if you open a terminal and run a tail every day, why are you running screen in the first place? The point of screen is so that you can disconnect/reconnect to a terminal session without stopping the processes running inside. This seems to be the opposite of how you're trying to use it. In other words, why are you using screen when you're just running a tail and you re-open it every morning regardless?

Last edited by suicidaleggroll; 12-02-2015 at 11:40 AM.
 
1 members found this post helpful.
Old 12-03-2015, 07:01 AM   #8
maples
Member
 
Registered: Oct 2013
Location: IN, USA
Distribution: Arch, Debian Jessie
Posts: 814

Rep: Reputation: 265Reputation: 265Reputation: 265
Quote:
Originally Posted by suicidaleggroll View Post
You can reconnect to them with "screen -r name".
I've noticed in my experience that if I close a terminal with a screen session inside, the screen session still thinks it's attached. So if you see
Code:
(Attached)
after the session you want to re-connect to, use
Code:
screen -dr (name)
This detaches the session, then reattaches to it with the current terminal.
 
  


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
labels for screen sessions Lop3 Linux - Software 3 11-13-2015 07:04 PM
Weird hourly cron sessions opening and closing for 'root' musicbrio Red Hat 4 09-12-2007 08:14 PM
Closing /killing other sessions WNS - SP-CAS Linux - Newbie 3 03-27-2006 12:00 PM
Closing my screen ikkuh1991 Linux - Laptop and Netbook 2 05-27-2005 10:50 AM
Laptop Hangs on Closing Screen llimllib Linux - Hardware 0 08-12-2002 06:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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