[NBLUG/talk] ipcs/ipcrm

Walter Hansen gandalf at sonic.net
Fri Jun 17 11:12:38 PDT 2005


I've got a machine running perl scripts that comunicate with each other.
The thing is they do so via shared variables, and the shared variables
hang arround afterwards. I can manually clean them up with ipcrm, but was
disapointed that there wasn't a command for ipcrm that kills all non
attached variables/sessions. I found a script that says it does that, but
it dies on my machine and it's been years since I've programmed in sh.
Anybody have any experience with this?

Yes, I tried google.
Yes, it's probably bad programming that they are left open but there are
70 scripts running and it's hard to determine which is the last one out.

Script I found that doesn't work:
#! /bin/sh
for PID in `ps -ef | grep -v root | grep -v proccessname | grep -v userid
| grep " 1 " | awk '{print $2}' `
do
echo killing $PID$TEST
kill $PID
for QID in `ipcs -qp | grep -w $PID | awk '{print $2}'`
do
echo removing $QID$TEST
ipcrm -q $QID
done





More information about the talk mailing list