reptyr

Wed 21 Jun 2023 12:22:33 PM EDT

So, I thought that I was done with writing today--at least for now--until my wifi decided to crap out on me and disconnect my session. I'm sure you know the feeling that I had next--that quick little race of the heart and perhaps a little flush of the face when your computer decides to treat you like Ellen Feiss[1], and like half of your paper is gone. Yeah.

1: https://www.youtube.com/watch?v=c72d4-LpilM

Well, see, I knew that if I didn't figure something out, all of my post would be gone as I've still not made it a habit to run screen or tmux before starting in on something lengthy. So, I was like, great, is there some sort of temporary file written somewhere keeping track of changes to the file I was creating. Well, there was, and when I googled if it was possible to recover it, my first answer showed me that only a couple of people have had success in figuring out the wizardry needed to open/edit/recover/revert/etc that silly .swp-file. Okay, so, is there an application or command that can steal a process? Turns out, there is. Reptyr.

https://github.com/nelhage/reptyr

If it's not already in your arsenal, I'd recommend equipping yourself with it, because it saved the day for me. A quick search of the repositories showed that it was available in Debian, so I didn't have to fuss with compiling, or anything; the only trick I needed to figure out was how to steal the process I wanted, which came down to me needing to be root--the process I really wanted to grab was a subprocess, and in order to take it I needed to take the beginning process, which requires root, apparently. So, a simple "su" and then a "reptyr -T PID" got me right back to where I was before the connection dropped--exactly where I was. Once I finished up my post, the script running things continued as it would've, wrapped things up, and brought me back to the shell I was in previously on the tablet. I exited that shell to return to the root shell I'd spawned, then exited it, and came back to the new shell I'd opened to start my attempts at recovering things.

Neat!

I know there might be a few that will read this and laugh at my amazement and joy in discovering a tool they already knew about, but, hey, I'm still learning. Hopefully this silly little post will help someone out, someday.

Thanks for reading;

--J

Tags: #gemini_crosspost

πŸ“ Comment on this post

Comments

reptyr – J. Palmer

[…] β€œreptyr” was originally published on J. Palmer […]

πŸ”™ Gemlog

πŸ” Home