the vim reaper

vim has a bad habit of chewing up a ton of CPU if user backgrounds it, closes their terminal window, or gets disconnected from the net with a vim session open. I see this every now and then on birdhouse – a vim process consuming 90% of CPU and owned by a user who’s not even logged in. Looked around for a solution for this apparently not uncommon problem on shared servers and didn’t come up with much, so wrote a quick shell script to dispatch justice when necessary: the vim reaper. Must be run as root, most likely via cron.

2 Replies to “the vim reaper”

  1. How does this play with vim’s in a screen? I for one have the habit of leaving an editor open but disconnecting (timing out) if I get an interrupt…

  2. Erwin, I haven’t tested for that. Does the screen command keep the user listed in the “who” output? If not, the session will be terminated. I could probably modify this script to respect screen sessions (as long as I can verify that they don’t chew CPU).

Leave a Reply

Your email address will not be published. Required fields are marked *