When the temp user logs in i see his session as below.
[root@techx ~]# who
root pts/0 2017-08-18 08:32 (121.87.51.113)
temp pts/1 2017-08-18 09:06 (121.87.51.113)
root pts/2 2017-08-18 08:59 (121.87.51.113)
When he logs out by either firing exit command or closing the putty window or clicking disconnect on mRemote i see temp user session destroyed as below.
[root@techx ~]# who
root pts/0 2017-08-18 08:32 (121.87.51.113)
root pts/2 2017-08-18 08:59 (121.87.51.113)
This is what i m doing catch a user logout action.
more .bash_logout
# ~/.bash_logout
rm -f flag_login
and in the
more .bash_profile
#!/bin/bash
if [ -f flag_login ]
then
echo "You have switched your working SHELL"
else
touch flag_login
fi
This works fine when the user types exit
command to logout of the session.
But when he logs out by closing the putty window or disconnect mRemote session to my L\Unix server the user session terminates but ~/.bash_logout
is not triggered and thus flag_login
file remains denoting the user is still on.
I do have the root privileges.
Can you please let me know how can i catch putty window close or mRemote disconnect the same way as i am catching the exit
command to work ?