Use case:
- You just started a process (i.e. compile, copy, etc).
- You noticed it will take much longer than expected to finish.
- You cannot abort or risk the process to get aborted due to the current shell session finishing.
- It would be ideal to have this process on ‘screen’ to have it running on backgroud.
We can move it to a screen session with the following steps:
- Suspend the process
-
press Ctrl+Z
-
- Resume the process in the background
-
bg
-
- Disown the process
-
disown %1
-
- Launch a screen session
-
screen
-
- Find the PID of the process
-
pgrep myappname
-
- Use reptyr to take over the process
-
reptyr 1234
-
Note: at the moment of writing this, reptyr is not available on any Fedore/Redhat repo. We’ll need to compile:
$ git clone https://github.com/nelhage/reptyr.git
$ cd reptyr/
$ make
$ sudo make install