I had this happen when someone ran a script to kill x11vnc every so often, using kill -9 (don’t ask).
Killing x11vnc with SIGTERM (15) allows it to clean up its shared memory segments. SIGKILL (9) will not.
Googling around, I found a script over here (backup copy here).
The problem with that was that it’s aimed at being run as the user, and it only supports usernames up to 10 characters, because of how “ipcs -m” prints its entries on Linux.
I wanted a solution that supported any length of username, and that could be run periodically, by root, as a cronjob to clean up after silly users, and that would also give me a report when it cleaned something, so I could see who was causing this.
The result was this script. It only supports Linux, and thus is a bit less portable than the one at karlrunge.com, but it does the job, even with long usernames, and generates such nice reports:
Removed SHM Segments: ___________________________ | OWNER | COUNT | |------------|------------| | bolt | 42 | |____________|____________| Total: 42
Oops…
EDIT:
Updated script, automatically synced with the one I’m actually using available here.
7 Comments
Great solution!
Nicely written!
Does exactly what I needed!
If you want to run the script I wrote, I strongly suggest you use the updated version I just added to the bottom of the post. The other one has some problems, like calling the “printusage” function which doesn’t exist in that script. If you had left your email address, I could have poked you about it 🙂
resolved the issue for me
OH YEAH!!!!!
Thanks for your sharing, it works!
Excellent stuff, thanks
Professionally written and works well
very much appreciated