I have some script on .bash_logout file. That script is running when a user is logging out using Ctrl+d or using exit command. If someone directly close putty application instead of logging out from the system, then .bash_logout is not running. Can anyone help me how to run .bash_logout even if someone close putty application without log out from the system? 
.bash_logout is not running on exit of putty
bash;logout
Added below function and a trap in .bashrc. The trap will trigger the function exit_session when the shell will get SIGHUP signal. exit_session() {    . $HOME/.bash_logout}trap exit_session SIGHUP