2016/01/15

Rescue vim process from other dead terminal session

Due to the fact that my office’s PC always down with no reason and leaving bunch of vim zombie sessions in my remote machine, I am tired for rescuing them times by times.
Finally, I found a way to resolve this issue.

Setup

  • OS: Ubuntu 14.04
  • Command required: reptyr and ps

Find PIDs of those zombie vim session

$> ps aux | grep vi

Rescue them

$> reptyr PID

Permission Problem

In case you got error like below
$ reptyr 1851
Unable to attach to pid 1851: Operation not permitted
The kernel denied permission while attaching. If your uid matches
the target's, check the value of /proc/sys/kernel/yama/ptrace_scope.
For more information, see /etc/sysctl.d/10-ptrace.conf
Fix this by editing configuration from 1 to 0
$vi /etc/sysctl.d/10-ptrace.conf

 kernel.yama.ptrace_scope = 0
Reload rule
$ sudo sysctl -p /etc/sysctl.d/10-ptrace.conf
Done.

References

沒有留言:

張貼留言