Problem description
After provisioning a Linux Rackspace Cloud Servers you can login to the server using ssh client.
If the ssh session is inactive for some time the underlying tcp session of the ssh connection will be automaticaly closed.
Impact
Often you work on the some server from multiple terminals or multiple ssh client sessions. When the ssh session timeouts you have to loggin again.
Depending on the ssh client you use the console output you had may be lost.
After logging again the bash history maybe lost.
Workaround
We can avoid the session to be terminated by trying to print something on the screen at a regular interval. The simple command below is going to manipulate the screen cursor position and prints a current data in the right bottom corner of the ssh session screen.
To execute it for every new ssh session opened we have to cusomise the bash .profile config file.
cat >> .profile <<DONE while true; do tput sc tput cup $(tput lines) $(tput cols) tput cub 8 echo -n $(date +%T) tput rc sleep 30 done & DONE
References
man terminfo
How to: Change / Setup bash custom prompt (PS1)
Colours and Cursor Movement With tput
http://bashish.sourceforge.net/
No comments:
Post a Comment