Monday, February 10, 2020

How to Keep your Linux Session Active?

How to keep you linux session active?

Frequently our linux terminal sessions are getting expiring due to idle timeout.

Biggest challenge is how to keep you terminal session active. There are several technics or methods to keep your session active.

1. Some people will set idle session timeout before the launch terminal.
2. Some people will launch the terminal in screen mode so that we can reconnect it back. 
3. Many other ways you can keep you session active 

Question is all above technics works if you are connecting to net terminal session, suppose you have already connected to terminal session and you forget to enable the screen or idle timeout options, in this case below are the few technics to keep your session alive.


1. Using watch command keep you session alive 

watch -n 2 date 
--- which will display date on every 2 seconds, Please read more on watch command usage

[infa@ETLD01 Scripts]$ watch -n 2 date 
Every 2.0s: date Sun Feb  9 20:06:19 2020
Sun Feb  9 20:06:19 +03 2020

2. Using vmstat command keep you session alive 

vmatat 100
--- which will keep count of the virtual memory usage for 100 times 

[infa@ETLD01 Scripts]$ vmstat 100
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 2  0   3808 47567996 198912 14133300    0    0     2  1963   22   14 15 36 46  3  0
^C
[infa@ETLD01 Scripts]$


3. Using top command keep you session alive 

top
--- top command displays processor activity of your Linux box and also displays tasks managed by kernel in real-time and keeps session active

[infa@ETLD01 Scripts]$ top
top - 20:03:44 up 5 days,  8:07,  2 users,  load average: 3.17, 3.55, 3.63
Tasks: 248 total,   5 running, 243 sleeping,   0 stopped,   0 zombie
%Cpu(s): 15.2 us, 40.9 sy,  0.0 ni, 40.9 id,  1.5 wa,  0.0 hi,  1.5 si,  0.0 st
KiB Mem : 65789768 total, 47562896 free,  3888520 used, 14338352 buff/cache
KiB Swap: 12578812 total, 12575004 free,     3808 used. 58083008 avail Mem

   PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
  1471 root      16  -4   55528   1092    652 R  87.5  0.0   6547:36 auditd
  1475 root      16  -4   33972   3976   1076 R  56.2  0.0   3926:51 audisp-remote


Regards,
Mallik

No comments:

Post a Comment

Automation Script | Archivelog Generation Hourly Monitoring

1. List out all the running databases and pic one database where we want to monitore the archive log generation from last 1 month. [oracle@o...