This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Wednesday, February 28, 2018

How to kill the IDLE pts/tty session in Linux Server?

 Kill the IDLE pts/tty session in Linux Server

Situation:
    Sometime script command may not be completed properly or sometime improperly closed ssh session makes the idle pts/tty session.
           
[root@dbserver ~]# w
 14:18:28 up 31 days,  4:18,  4 users,  load average: 3.35, 3.42, 3.41
USER     TTY      FROM  LOGIN@   IDLE     JCPU   PCPU  WHAT
root        pts/2    -            27Jan18   31days  0.00s  0.00s   script -a /os_backup_fs/patches/DB_Server/logs/dbserver_Postwork-1.log


Solution:
Here, sometime ps -ft command will not respond

[root@dbserver ~]# ps -ft pts/2
UID         PID   PPID  C STIME TTY          TIME CMD

So, search with process and kill the process id.

[root@dbserver ~]# ps -ef | grep -i /os_backup_fs/patches/DB_Server/logs/dbserver_Postwork-1.log
root     202948 185999  0 14:18 pts/4    00:00:00 grep -i /os_backup_fs/patches/DB_Server/logs/dbserver_Postwork-1.log
root     271243 113886  0 Jan27 pts/1    00:00:00 script -a /os_backup_fs/patches/DB_Server/logs/dbserver_Postwork-1.log
root     271245 271243  0 Jan27 pts/1    00:00:00 script -a /os_backup_fs/patches/DB_Server/logs/dbserver_Postwork-1.log
[root@dbserver ~]# kill -9 271243

Hope it helps.

No comments:

Post a Comment