Unsolved Save shell session to disk?
-
tmux is really the closest thing I know of, but it won't save to disk or survive a reboot.
-
You might want to use Putty as a choice.
-
@stacksofplates said in Save shell session to disk?:
tmux is really the closest thing I know of, but it won't save to disk or survive a reboot.
Yes, I usually use
screen
but it won't save or survive a reboot either. -
@ITivan80 said in Save shell session to disk?:
You might want to use Putty as a choice.
Thanks, I do sometimes on Windows but the problem I have isn't saving ssh sessions on the client, such as login credentials, which
putty
does.The problem is that I want to save the unix shell session on the server. Screen buffers, environment variables, history, current directory etc. So I can resume my work later from the same point.
-
@Pete-S said in Save shell session to disk?:
Is there a way you can save a shell session to disk for later recall?
It would save your current directory, environment variables, screen buffer etc.I've never heard of anything like this. I have also never looked, but if it exists, it is not commonly known.
-
@ITivan80 said in Save shell session to disk?:
You might want to use Putty as a choice.
PuTTY is a terminal app, but isn't aware of what is happening inside of it. So doesn't manage any of these features, and it isn't needed. Every OS now has good, native terminals so the era of PuTTY is long over. It's a good tool if Windows didnt have a good terminal natively, but it does.
-
@Pete-S said in Save shell session to disk?:
The problem is that I want to save the unix shell session on the server. Screen buffers, environment variables, history, current directory etc. So I can resume my work later from the same point.
So there are two ways to do this...
-
Work in an idempotent way and be stateless. Basically doing functional programming. Huge pain and no one does this. But this is how this would be handled.
-
Live without the ability to survive a SERVER side reboot, and just use screen and it is designed to do this (except for the reboot thing.) You disconnect your session and can pick it back up in situ from anywhere.
-
-
But nothing AFAIK will flush a state to disk to save for later. That would be effectively impossible as nothing can control the state in such a way as to be able to reliably do that. Because of the way that it affects other things, saving the system state isn't viable at the user level.
-
@scottalanmiller said in Save shell session to disk?:
Live without the ability to survive a SERVER side reboot, and just use screen and it is designed to do this (except for the reboot thing.) You disconnect your session and can pick it back up in situ from anywhere.
This is what I don on the rare occasion that i know ahead of time that I need to preserve an environment to come back to later.
It almost never happens that I know ahead of time, and I do not like to launch screen for no reason.
-
@JaredBusch said in Save shell session to disk?:
It almost never happens that I know ahead of time, and I do not like to launch screen for no reason.
That totally gets me, too.
-
@scottalanmiller said in Save shell session to disk?:
@JaredBusch said in Save shell session to disk?:
It almost never happens that I know ahead of time, and I do not like to launch screen for no reason.
That totally gets me, too.
That's why you should launch ssh like this:
ssh [email protected] -t screen -RR
If you don't have a session going it will create one.
If you had a session going but it was interrupted, it will reconnect to it automatically.And it's completely transparent from the users point of view. No need to run any
screen
commands or keyboard shortcuts.Especially good in these situations:
- a laptop that you close the lid on
- flaky internet connection
- desktop PC in a country with unreliable power grid
- when running a process that takes a long time, like copying files
-
@scottalanmiller said in Save shell session to disk?:
@Pete-S said in Save shell session to disk?:
The problem is that I want to save the unix shell session on the server. Screen buffers, environment variables, history, current directory etc. So I can resume my work later from the same point.
So there are two ways to do this...
-
Work in an idempotent way and be stateless. Basically doing functional programming. Huge pain and no one does this. But this is how this would be handled.
-
Live without the ability to survive a SERVER side reboot, and just use screen and it is designed to do this (except for the reboot thing.) You disconnect your session and can pick it back up in situ from anywhere.
Number 2 is what I do today.
-
-
@Pete-S said in Save shell session to disk?:
That's why you should launch ssh like this:
ssh [email protected] -t screen -RR
If you don't have a session going it will create one.
If you had a session going but it was interrupted, it will reconnect to it automatically.@JaredBusch said in Save shell session to disk?:
I do not like to launch screen for no reason.