First start an ipython session first printing out the PID.
bash -c "echo $$; exec ipython"
I also tried changing the name of the process so you can name them but it didn’t seem to work, although there is probably something you can do to be able to do this:
bash -c "echo $$; exec -a sessionname ipython"
In that case you would’nt really even need the PID:
bash -c "exec -a sessionname ipython"
Then we use CRIU to checkpoint it:
If we can rename it:
sudo criu dump -D session_image_dir -o dump.log -t $(pgrep "sessionname")
If we can’t just use the PID
bash -c "session_pid=$$; exec ipython"
sudo criu dump --shell-job -D session_image_dir -o dump.log -t ${session_pid}
The files should be in the session_image_dir, along with the log.
Then to get it back:
sudo criu restore --shell-job -D session_image_dir -o restore.log
Then you just need to refresh the terminal emulator.