scot hacker’s foobar blog
It's a hassle you know to make rocket ships go to infinity. -Gong
June 30, 2006

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 Responses to “the vim reaper”

  1. Erwin:

    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. shacker:

    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

→ Want an avatar/icon to show up alongside your comment? Get a free Gravatar. ←