Last active
July 14, 2019 13:40
-
-
Save kaanklky/e600bd0c55238429ec2122200e0bdefd to your computer and use it in GitHub Desktop.
Save terminal sessions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Record terminal sessions | |
| if [ "x$SESSION_RECORD" = "x" ] | |
| then | |
| TTY_CON=$(tty | cut -d '/' -f3)/$(tty | cut -d '/' -f4) | |
| TTY_IP=$(who | grep "${TTY_CON}" | cut -d ' ' -f16 | tr -d '()') | |
| output=/var/log/session/session_$(date +%F_%H-%M-%S)_$USER.$TTY_IP | |
| SESSION_RECORD=started | |
| export SESSION_RECORD | |
| script -t -f -q 2>${output}.timing $output | |
| exit | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment