I need to know how to kill all processes for a logged in user except the first one in linux redhat 6.
AZain user is logged in multiple times from different machines so I need to allow only the first process and kill all others for this user:
who -u AZain pts/2 2016-06-23 08:34 . 27191 (localhost) AZain pts/4 2016-06-23 09:01 . 28885 (localhost) root pts/0 2016-06-23 08:14 . 25962 (10.11.155.23) AZain pts/1 2016-06-23 08:34 00:27 27169 (10.11.155.23) AZain pts/3 2016-06-23 09:01 . 28867 (10.11.155.14)
Edit: I am trying to do so as I am having an application in which consumes licenses for users. So every new session for the same user would consume more license. If I could prevent any new logins for the same user that would be great.